Home > machine > Soleil > common > synchro > synchro_injecteur6.m

synchro_injecteur6

PURPOSE ^

SYNCHRO_INJECTEUR6 M-file for synchro_injecteur6.fig

SYNOPSIS ^

function varargout = synchro_injecteur6(varargin)

DESCRIPTION ^

 SYNCHRO_INJECTEUR6 M-file for synchro_injecteur6.fig
      SYNCHRO_INJECTEUR6, by itself, creates a new SYNCHRO_INJECTEUR6 or raises the existing
      singleton*.

      H = SYNCHRO_INJECTEUR6 returns the handle to a new SYNCHRO_INJECTEUR6 or the handle to
      the existing singleton*.

      SYNCHRO_INJECTEUR6('CALLBACK',hObject,eventData,handles,...) calls the local
      function named CALLBACK in SYNCHRO_INJECTEUR6.M with the given input arguments.

      SYNCHRO_INJECTEUR6('Property','Value',...) creates a new SYNCHRO_INJECTEUR6 or raises the
      existing singleton*.  Starting from the left, property value pairs are
      applied to the GUI before synchro_injecteur6_OpeningFunction gets called.  An
      unrecognized property name or invalid value makes property application
      stop.  All inputs are passed to synchro_injecteur6_OpeningFcn via varargin.

      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
      instance to run (singleton)".

 See also: GUIDE, GUIDATA, GUIHANDLES

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = synchro_injecteur6(varargin)
0002 % SYNCHRO_INJECTEUR6 M-file for synchro_injecteur6.fig
0003 %      SYNCHRO_INJECTEUR6, by itself, creates a new SYNCHRO_INJECTEUR6 or raises the existing
0004 %      singleton*.
0005 %
0006 %      H = SYNCHRO_INJECTEUR6 returns the handle to a new SYNCHRO_INJECTEUR6 or the handle to
0007 %      the existing singleton*.
0008 %
0009 %      SYNCHRO_INJECTEUR6('CALLBACK',hObject,eventData,handles,...) calls the local
0010 %      function named CALLBACK in SYNCHRO_INJECTEUR6.M with the given input arguments.
0011 %
0012 %      SYNCHRO_INJECTEUR6('Property','Value',...) creates a new SYNCHRO_INJECTEUR6 or raises the
0013 %      existing singleton*.  Starting from the left, property value pairs are
0014 %      applied to the GUI before synchro_injecteur6_OpeningFunction gets called.  An
0015 %      unrecognized property name or invalid value makes property application
0016 %      stop.  All inputs are passed to synchro_injecteur6_OpeningFcn via varargin.
0017 %
0018 %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
0019 %      instance to run (singleton)".
0020 %
0021 % See also: GUIDE, GUIDATA, GUIHANDLES
0022 
0023 % Edit the above text to modify the response to help synchro_injecteur6
0024 
0025 % Last Modified by GUIDE v2.5 05-Dec-2006 14:53:15
0026 
0027 % Begin initialization code - DO NOT EDIT
0028 gui_Singleton = 1;
0029 gui_State = struct('gui_Name',       mfilename, ...
0030                    'gui_Singleton',  gui_Singleton, ...
0031                    'gui_OpeningFcn', @synchro_injecteur6_OpeningFcn, ...
0032                    'gui_OutputFcn',  @synchro_injecteur6_OutputFcn, ...
0033                    'gui_LayoutFcn',  [] , ...
0034                    'gui_Callback',   []);
0035 if nargin && ischar(varargin{1})
0036     gui_State.gui_Callback = str2func(varargin{1});
0037 end
0038 
0039 if nargout
0040     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0041 else
0042     gui_mainfcn(gui_State, varargin{:});
0043 end
0044 % End initialization code - DO NOT EDIT
0045 
0046 
0047 % --- Executes just before synchro_injecteur6 is made visible.
0048 function synchro_injecteur6_OpeningFcn(hObject, eventdata, handles, varargin)
0049 % This function has no output args, see OutputFcn.
0050 % hObject    handle to figure
0051 % eventdata  reserved - to be defined in a future version of MATLAB
0052 % handles    structure with handles and user data (see GUIDATA)
0053 % varargin   command line arguments to synchro_injecteur6 (see VARARGIN)
0054 
0055 % Choose default command line output for synchro_injecteur6
0056 handles.output = hObject;
0057 
0058 % Charge les offset
0059 load('synchro_offset_lin', 'inj_offset' , 'ext_offset', 'lin_fin');
0060 set(handles.inj_offset,'String',num2str(inj_offset));
0061 set(handles.ext_offset,'String',num2str(ext_offset));
0062 set(handles.lin_canon_spm_fin,'String',num2str(lin_fin));
0063 % Periode linac fin
0064 handles.lin_fin_step=0.090;                   % En ns  (90 ps)
0065 handles.one_bunch=2.84/handles.lin_fin_step;  % Nombre de pas pour sauter un paquet
0066 
0067 % Periode du trigger par defaut = 10 s
0068 handles.periode = 10;
0069 set(handles.periode_edit,'String',num2str(handles.periode));
0070 set(handles.edit_Nshot_soft,'String',num2str(1));
0071 set(handles.edit_laps,'String',1.0);
0072 
0073 %Memorise les délais pc et soft initiaux
0074 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcStepDelay');
0075 clk1=temp.value(1);
0076 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
0077 clk2=temp.value(1);
0078 
0079 %Stocke les sauts pour les 4 quarts mode LPM
0080 jump=int32([0 39 26 13]);
0081 handles.clk_pc  =jump +  int32(clk1);
0082 handles.clk_soft=jump  + int32(clk2);
0083 handles.quart=1;
0084 
0085 % Table initiale sur paquet 1
0086 bunch=[1];
0087 [dtour,dpaquet]=bucketnumber(bunch);
0088 offset_linac=lin_fin/handles.lin_fin_step; 
0089 bjump=handles.one_bunch;
0090 dpaquet=dpaquet*bjump+offset_linac;
0091 handles.table=int32([length(bunch) dtour dpaquet]);
0092 handles.table0=handles.table;
0093 handles.bunch=bunch;
0094 
0095 handles.mode = 'Mode=???';
0096 set(handles.edit_filling_relecture_tables,'Enable','off');
0097 set(handles.edit_filling_relecture_bunch,'Enable','off');
0098 
0099 
0100 % Verifie le mode selectionné en SPM ou LPM
0101 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
0102 modelpm=temp.value(1);
0103 temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent');
0104 modespm=temp.value(1);
0105 h=get(handles.uipanel_lpm_spm_mode);
0106 if     (modelpm==5)&(modespm==0)
0107     set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(2))
0108 elseif (modelpm==0)&(modespm==5)
0109     set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(1))
0110 else
0111     set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(3))
0112 end
0113 
0114 
0115 
0116 % Verifie le mode selectionné en SPM : 1 2 ou 3 paquets
0117 temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'mode');
0118 mode=temp.value(1);
0119 h=get(handles.uipanel_spm_mode);
0120 select=h.Children(5-mode);
0121 set(handles.uipanel_spm_mode,'SelectedObject',select)
0122 
0123 % Verifie le mode d'injection selectionné : soft ou 3Hz
0124 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareEvent');
0125 mode=temp.value(1);
0126 h=get(handles.uipanel_mode);
0127 if     mode==2
0128     set(handles.uipanel_mode,'SelectedObject',h.Children(1))
0129 elseif mode==1
0130     set(handles.uipanel_mode,'SelectedObject',h.Children(2))
0131 else
0132     set(handles.uipanel_mode,'SelectedObject',[])
0133 end
0134 
0135 
0136 % Cache le tableau des délais BPM
0137 set(handles.panel_bpm,'Visible','off');
0138 
0139 
0140 
0141 % Fonction timer pour injection en boucle
0142 % Creates timer Infinite loop
0143 timer2=timer('StartDelay',1,...
0144     'ExecutionMode','fixedRate','Period',3,'TasksToExecute',Inf);
0145 timer2.TimerFcn = {@fonction_alex2, hObject,eventdata, handles};
0146 setappdata(handles.figure1,'Timer2',timer2);
0147 
0148 % Creates timer Infinite loop
0149 timer1=timer('StartDelay',1,...
0150     'ExecutionMode','fixedRate','Period',handles.periode,'TasksToExecute',Inf);
0151 timer1.TimerFcn = {@fonction_alex1, hObject,eventdata, handles};
0152 setappdata(handles.figure1,'Timer1',timer1);
0153 
0154 % button group sur on/off timer du trigger
0155 h = uibuttongroup('visible','off','Position',[0.1405 0.32 0.11 0.14],...
0156     'Title','','TitlePosition','centertop',...
0157     'BackgroundColor',[1 0.3 0 ]);
0158 u1 = uicontrol('Style','Radio','String',' OFF','Tag','radiobutton1',...
0159     'pos',[05 85 55 25],'parent',h,'HandleVisibility','off',...
0160     'BackgroundColor',[1 0.3 0  ]);
0161 u2 = uicontrol('Style','Radio','String',' Laps :','Tag','radiobutton2',...
0162     'pos',[05 45 55 25],'parent',h,'HandleVisibility','off',...
0163     'BackgroundColor',[1 0.3 0 ]);
0164 u3 = uicontrol('Style','Radio','String',' Imin :','Tag','radiobutton3',...
0165     'pos',[05 05 55 25],'parent',h,'HandleVisibility','off',...
0166     'BackgroundColor',[1 0.3 0 ]);
0167 
0168 set(h,'SelectionChangeFcn',...
0169     {@uibuttongroup_SelectionChangeFcn,handles});
0170 
0171 handles.off = u1;
0172 handles.on1 = u2;
0173 handles.on2 = u3;
0174 
0175 set(h,'SelectedObject',u1); 
0176 set(h,'Visible','on');
0177 
0178 %% Set closing gui function
0179 set(handles.figure1,'CloseRequestFcn',{@Closinggui,timer1,handles.figure1});
0180 set(handles.figure1,'CloseRequestFcn',{@Closinggui,timer2,handles.figure1});
0181 
0182 
0183 % Update handles structure
0184 guidata(hObject, handles);
0185 
0186 % UIWAIT makes synchro_injecteur6 wait for user response (see UIRESUME)
0187 % uiwait(handles.figure1);
0188 
0189 
0190 % --- Outputs from this function are returned to the command line.
0191 function varargout = synchro_injecteur6_OutputFcn(hObject, eventdata, handles) 
0192 % varargout  cell array for returning output args (see VARARGOUT);
0193 % hObject    handle to figure
0194 % eventdata  reserved - to be defined in a future version of MATLAB
0195 % handles    structure with handles and user data (see GUIDATA)
0196 
0197 % Get default command line output from handles structure
0198 varargout{1} = handles.output;
0199 
0200 
0201 
0202 function boo_alim_dipole_Callback(hObject, eventdata, handles)
0203 % hObject    handle to boo_alim_dipole (see GCBO)
0204 % eventdata  reserved - to be defined in a future version of MATLAB
0205 % handles    structure with handles and user data (see GUIDATA)
0206 
0207 % Hints: get(hObject,'String') returns contents of boo_alim_dipole as text
0208 %        str2double(get(hObject,'String')) returns contents of boo_alim_dipole as a double
0209 %h=gcf
0210 delay=str2double(get(hObject,'String'));
0211 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'dpTimeDelay',delay);
0212 
0213 % --- Executes during object creation, after setting all properties.
0214 function boo_alim_dipole_CreateFcn(hObject, eventdata, handles)
0215 % hObject    handle to boo_alim_dipole (see GCBO)
0216 % eventdata  reserved - to be defined in a future version of MATLAB
0217 % handles    empty - handles not created until after all CreateFcns called
0218 
0219 % Hint: edit controls usually have a white background on Windows.
0220 %       See ISPC and COMPUTER.
0221 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0222     set(hObject,'BackgroundColor','white');
0223 end
0224 
0225 
0226 function boo_alim_qf_Callback(hObject, eventdata, handles)
0227 % hObject    handle to boo_alim_qf (see GCBO)
0228 % eventdata  reserved - to be defined in a future version of MATLAB
0229 % handles    structure with handles and user data (see GUIDATA)
0230 
0231 % Hints: get(hObject,'String') returns contents of boo_alim_qf as text
0232 %        str2double(get(hObject,'String')) returns contents of boo_alim_qf as a double
0233 
0234 delay=str2double(get(hObject,'String'));
0235 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTimeDelay',delay);
0236 
0237 % --- Executes during object creation, after setting all properties.
0238 function boo_alim_qf_CreateFcn(hObject, eventdata, handles)
0239 % hObject    handle to boo_alim_qf (see GCBO)
0240 % eventdata  reserved - to be defined in a future version of MATLAB
0241 % handles    empty - handles not created until after all CreateFcns called
0242 
0243 % Hint: edit controls usually have a white background on Windows.
0244 %       See ISPC and COMPUTER.
0245 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0246     set(hObject,'BackgroundColor','white');
0247 end
0248 
0249 
0250 
0251 function boo_alim_qd_Callback(hObject, eventdata, handles)
0252 % hObject    handle to boo_alim_qd (see GCBO)
0253 % eventdata  reserved - to be defined in a future version of MATLAB
0254 % handles    structure with handles and user data (see GUIDATA)
0255 
0256 % Hints: get(hObject,'String') returns contents of boo_alim_qd as text
0257 %        str2double(get(hObject,'String')) returns contents of boo_alim_qd as a double
0258 
0259 delay=str2double(get(hObject,'String'));
0260 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTimeDelay',delay);
0261 
0262 % --- Executes during object creation, after setting all properties.
0263 function boo_alim_qd_CreateFcn(hObject, eventdata, handles)
0264 % hObject    handle to boo_alim_qd (see GCBO)
0265 % eventdata  reserved - to be defined in a future version of MATLAB
0266 % handles    empty - handles not created until after all CreateFcns called
0267 
0268 % Hint: edit controls usually have a white background on Windows.
0269 %       See ISPC and COMPUTER.
0270 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0271     set(hObject,'BackgroundColor','white');
0272 end
0273 
0274 
0275 
0276 function boo_alim_sf_Callback(hObject, eventdata, handles)
0277 % hObject    handle to boo_alim_sf (see GCBO)
0278 % eventdata  reserved - to be defined in a future version of MATLAB
0279 % handles    structure with handles and user data (see GUIDATA)
0280 
0281 % Hints: get(hObject,'String') returns contents of boo_alim_sf as text
0282 %        str2double(get(hObject,'String')) returns contents of boo_alim_sf as a double
0283 
0284 delay=str2double(get(hObject,'String'));
0285 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'sfTimeDelay',delay);
0286 
0287 % --- Executes during object creation, after setting all properties.
0288 function boo_alim_sf_CreateFcn(hObject, eventdata, handles)
0289 % hObject    handle to boo_alim_sf (see GCBO)
0290 % eventdata  reserved - to be defined in a future version of MATLAB
0291 % handles    empty - handles not created until after all CreateFcns called
0292 
0293 % Hint: edit controls usually have a white background on Windows.
0294 %       See ISPC and COMPUTER.
0295 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0296     set(hObject,'BackgroundColor','white');
0297 end
0298 
0299 
0300 
0301 function boo_alim_sd_Callback(hObject, eventdata, handles)
0302 % hObject    handle to boo_alim_sd (see GCBO)
0303 % eventdata  reserved - to be defined in a future version of MATLAB
0304 % handles    structure with handles and user data (see GUIDATA)
0305 
0306 % Hints: get(hObject,'String') returns contents of boo_alim_sd as text
0307 %        str2double(get(hObject,'String')) returns contents of boo_alim_sd as a double
0308 
0309 delay=str2double(get(hObject,'String'));
0310 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'sdTimeDelay',delay);
0311 
0312 
0313 % --- Executes during object creation, after setting all properties.
0314 function boo_alim_sd_CreateFcn(hObject, eventdata, handles)
0315 % hObject    handle to boo_alim_sd (see GCBO)
0316 % eventdata  reserved - to be defined in a future version of MATLAB
0317 % handles    empty - handles not created until after all CreateFcns called
0318 
0319 % Hint: edit controls usually have a white background on Windows.
0320 %       See ISPC and COMPUTER.
0321 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0322     set(hObject,'BackgroundColor','white');
0323 end
0324 
0325 
0326 
0327 function boo_rf_Callback(hObject, eventdata, handles)
0328 % hObject    handle to boo_rf (see GCBO)
0329 % eventdata  reserved - to be defined in a future version of MATLAB
0330 % handles    structure with handles and user data (see GUIDATA)
0331 
0332 % Hints: get(hObject,'String') returns contents of boo_rf as text
0333 %        str2double(get(hObject,'String')) returns contents of boo_rf as a double
0334 
0335 delay=str2double(get(hObject,'String'));
0336 tango_write_attribute2('BOO/SY/LOCAL.RF.1', 'rfTimeDelay',delay);
0337 
0338 % --- Executes during object creation, after setting all properties.
0339 function boo_rf_CreateFcn(hObject, eventdata, handles)
0340 % hObject    handle to boo_rf (see GCBO)
0341 % eventdata  reserved - to be defined in a future version of MATLAB
0342 % handles    empty - handles not created until after all CreateFcns called
0343 
0344 % Hint: edit controls usually have a white background on Windows.
0345 %       See ISPC and COMPUTER.
0346 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0347     set(hObject,'BackgroundColor','white');
0348 end
0349 
0350 
0351 
0352 function lin_canon_lpm_Callback(hObject, eventdata, handles)
0353 % hObject    handle to lin_canon_lpm (see GCBO)
0354 % eventdata  reserved - to be defined in a future version of MATLAB
0355 % handles    structure with handles and user data (see GUIDATA)
0356 
0357 % Hints: get(hObject,'String') returns contents of lin_canon_lpm as text
0358 %        str2double(get(hObject,'String')) returns contents of lin_canon_lpm as a double
0359 
0360 inj_offset=str2double(get(handles.inj_offset,'String'));
0361 delay=str2double(get(hObject,'String'))+inj_offset;
0362 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmTimeDelay',delay);
0363 
0364 
0365 % --- Executes during object creation, after setting all properties.
0366 function lin_canon_lpm_CreateFcn(hObject, eventdata, handles)
0367 % hObject    handle to lin_canon_lpm (see GCBO)
0368 % eventdata  reserved - to be defined in a future version of MATLAB
0369 % handles    empty - handles not created until after all CreateFcns called
0370 
0371 % Hint: edit controls usually have a white background on Windows.
0372 %       See ISPC and COMPUTER.
0373 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0374     set(hObject,'BackgroundColor','white');
0375 end
0376 
0377 
0378 
0379 function lt1_emittance_Callback(hObject, eventdata, handles)
0380 % hObject    handle to lt1_emittance (see GCBO)
0381 % eventdata  reserved - to be defined in a future version of MATLAB
0382 % handles    structure with handles and user data (see GUIDATA)
0383 
0384 % Hints: get(hObject,'String') returns contents of lt1_emittance as text
0385 %        str2double(get(hObject,'String')) returns contents of lt1_emittance as a double
0386 inj_offset=str2double(get(handles.inj_offset,'String'));
0387 delay=str2double(get(hObject,'String'))+inj_offset;
0388 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceTimeDelay',delay);
0389 
0390 % --- Executes during object creation, after setting all properties.
0391 function lt1_emittance_CreateFcn(hObject, eventdata, handles)
0392 % hObject    handle to lt1_emittance (see GCBO)
0393 % eventdata  reserved - to be defined in a future version of MATLAB
0394 % handles    empty - handles not created until after all CreateFcns called
0395 
0396 % Hint: edit controls usually have a white background on Windows.
0397 %       See ISPC and COMPUTER.
0398 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0399     set(hObject,'BackgroundColor','white');
0400 end
0401 
0402 
0403 
0404 function lt1_MC1_Callback(hObject, eventdata, handles)
0405 % hObject    handle to lt1_MC1 (see GCBO)
0406 % eventdata  reserved - to be defined in a future version of MATLAB
0407 % handles    structure with handles and user data (see GUIDATA)
0408 
0409 % Hints: get(hObject,'String') returns contents of lt1_MC1 as text
0410 %        str2double(get(hObject,'String')) returns contents of lt1_MC1 as a double
0411 inj_offset=str2double(get(handles.inj_offset,'String'));
0412 delay=str2double(get(hObject,'String'))+inj_offset;
0413 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1TimeDelay',delay);
0414 
0415 % --- Executes during object creation, after setting all properties.
0416 function lt1_MC1_CreateFcn(hObject, eventdata, handles)
0417 % hObject    handle to lt1_MC1 (see GCBO)
0418 % eventdata  reserved - to be defined in a future version of MATLAB
0419 % handles    empty - handles not created until after all CreateFcns called
0420 
0421 % Hint: edit controls usually have a white background on Windows.
0422 %       See ISPC and COMPUTER.
0423 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0424     set(hObject,'BackgroundColor','white');
0425 end
0426 
0427 
0428 
0429 function lt1_MC2_Callback(hObject, eventdata, handles)
0430 % hObject    handle to lt1_MC2 (see GCBO)
0431 % eventdata  reserved - to be defined in a future version of MATLAB
0432 % handles    structure with handles and user data (see GUIDATA)
0433 
0434 % Hints: get(hObject,'String') returns contents of lt1_MC2 as text
0435 %        str2double(get(hObject,'String')) returns contents of lt1_MC2 as a double
0436 inj_offset=str2double(get(handles.inj_offset,'String'));
0437 delay=str2double(get(hObject,'String'))+inj_offset;
0438 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2TimeDelay',delay);
0439 
0440 % --- Executes during object creation, after setting all properties.
0441 function lt1_MC2_CreateFcn(hObject, eventdata, handles)
0442 % hObject    handle to lt1_MC2 (see GCBO)
0443 % eventdata  reserved - to be defined in a future version of MATLAB
0444 % handles    empty - handles not created until after all CreateFcns called
0445 
0446 % Hint: edit controls usually have a white background on Windows.
0447 %       See ISPC and COMPUTER.
0448 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0449     set(hObject,'BackgroundColor','white');
0450 end
0451 
0452 
0453 
0454 function lt1_osc_Callback(hObject, eventdata, handles)
0455 % hObject    handle to lt1_osc (see GCBO)
0456 % eventdata  reserved - to be defined in a future version of MATLAB
0457 % handles    structure with handles and user data (see GUIDATA)
0458 
0459 % Hints: get(hObject,'String') returns contents of lt1_osc as text
0460 %        str2double(get(hObject,'String')) returns contents of lt1_osc as a double
0461 inj_offset=str2double(get(handles.inj_offset,'String'));
0462 delay=str2double(get(hObject,'String'))+inj_offset;
0463 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'oscTimeDelay',delay);
0464 
0465 
0466 % --- Executes during object creation, after setting all properties.
0467 function lt1_osc_CreateFcn(hObject, eventdata, handles)
0468 % hObject    handle to lt1_osc (see GCBO)
0469 % eventdata  reserved - to be defined in a future version of MATLAB
0470 % handles    empty - handles not created until after all CreateFcns called
0471 
0472 % Hint: edit controls usually have a white background on Windows.
0473 %       See ISPC and COMPUTER.
0474 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0475     set(hObject,'BackgroundColor','white');
0476 end
0477 
0478 
0479 
0480 function sdc1_Callback(hObject, eventdata, handles)
0481 % hObject    handle to sdc1 (see GCBO)
0482 % eventdata  reserved - to be defined in a future version of MATLAB
0483 % handles    structure with handles and user data (see GUIDATA)
0484 
0485 % Hints: get(hObject,'String') returns contents of sdc1 as text
0486 %        str2double(get(hObject,'String')) returns contents of sdc1 as a double
0487 inj_offset=str2double(get(handles.inj_offset,'String'));
0488 delay=str2double(get(hObject,'String'))+inj_offset;
0489 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'oscTimeDelay',delay);
0490 
0491 % --- Executes during object creation, after setting all properties.
0492 function sdc1_CreateFcn(hObject, eventdata, handles)
0493 % hObject    handle to sdc1 (see GCBO)
0494 % eventdata  reserved - to be defined in a future version of MATLAB
0495 % handles    empty - handles not created until after all CreateFcns called
0496 
0497 % Hint: edit controls usually have a white background on Windows.
0498 %       See ISPC and COMPUTER.
0499 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0500     set(hObject,'BackgroundColor','white');
0501 end
0502 
0503 
0504 
0505 function boo_inj_septum_Callback(hObject, eventdata, handles)
0506 % hObject    handle to boo_inj_septum (see GCBO)
0507 % eventdata  reserved - to be defined in a future version of MATLAB
0508 % handles    structure with handles and user data (see GUIDATA)
0509 
0510 % Hints: get(hObject,'String') returns contents of boo_inj_septum as text
0511 %        str2double(get(hObject,'String')) returns contents of boo_inj_septum as a double
0512 inj_offset=str2double(get(handles.inj_offset,'String'));
0513 delay=str2double(get(hObject,'String'))+inj_offset;
0514 tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigTimeDelay',delay);
0515 
0516 % --- Executes during object creation, after setting all properties.
0517 function boo_inj_septum_CreateFcn(hObject, eventdata, handles)
0518 % hObject    handle to boo_inj_septum (see GCBO)
0519 % eventdata  reserved - to be defined in a future version of MATLAB
0520 % handles    empty - handles not created until after all CreateFcns called
0521 
0522 % Hint: edit controls usually have a white background on Windows.
0523 %       See ISPC and COMPUTER.
0524 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0525     set(hObject,'BackgroundColor','white');
0526 end
0527 
0528 
0529 
0530 function boo_inj_kicker_Callback(hObject, eventdata, handles)
0531 % hObject    handle to boo_inj_kicker (see GCBO)
0532 % eventdata  reserved - to be defined in a future version of MATLAB
0533 % handles    structure with handles and user data (see GUIDATA)
0534 
0535 % Hints: get(hObject,'String') returns contents of boo_inj_kicker as text
0536 %        str2double(get(hObject,'String')) returns contents of boo_inj_kicker as a double
0537 inj_offset=str2double(get(handles.inj_offset,'String'));
0538 delay=str2double(get(hObject,'String'))+inj_offset;
0539 tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigTimeDelay',delay);
0540 
0541 % --- Executes during object creation, after setting all properties.
0542 function boo_inj_kicker_CreateFcn(hObject, eventdata, handles)
0543 % hObject    handle to boo_inj_kicker (see GCBO)
0544 % eventdata  reserved - to be defined in a future version of MATLAB
0545 % handles    empty - handles not created until after all CreateFcns called
0546 
0547 % Hint: edit controls usually have a white background on Windows.
0548 %       See ISPC and COMPUTER.
0549 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0550     set(hObject,'BackgroundColor','white');
0551 end
0552 
0553 
0554 
0555 function boo_bpm_Callback(hObject, eventdata, handles)
0556 % hObject    handle to boo_bpm (see GCBO)
0557 % eventdata  reserved - to be defined in a future version of MATLAB
0558 % handles    structure with handles and user data (see GUIDATA)
0559 
0560 % Hints: get(hObject,'String') returns contents of boo_bpm as text
0561 %        str2double(get(hObject,'String')) returns contents of boo_bpm as a double
0562 
0563 inj_offset=str2double(get(handles.inj_offset,'String'));
0564 delay=str2double(get(hObject,'String'))+inj_offset;
0565 tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigTimeDelay',delay);
0566 tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-btd.trigTimeDelay',delay);
0567 tango_write_attribute2('BOO/SY/LOCAL.DG.2', 'bpm-btb.trigTimeDelay',delay);
0568 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-btc.trigTimeDelay',delay);
0569 
0570 
0571 % --- Executes during object creation, after setting all properties.
0572 function boo_bpm_CreateFcn(hObject, eventdata, handles)
0573 % hObject    handle to boo_bpm (see GCBO)
0574 % eventdata  reserved - to be defined in a future version of MATLAB
0575 % handles    empty - handles not created until after all CreateFcns called
0576 
0577 % Hint: edit controls usually have a white background on Windows.
0578 %       See ISPC and COMPUTER.
0579 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0580     set(hObject,'BackgroundColor','white');
0581 end
0582 
0583 
0584 
0585 function boo_nod_Callback(hObject, eventdata, handles)
0586 % hObject    handle to boo_nod (see GCBO)
0587 % eventdata  reserved - to be defined in a future version of MATLAB
0588 % handles    structure with handles and user data (see GUIDATA)
0589 
0590 % Hints: get(hObject,'String') returns contents of boo_nod as text
0591 %        str2double(get(hObject,'String')) returns contents of boo_nod as a double
0592 inj_offset=str2double(get(handles.inj_offset,'String'));
0593 delay=str2double(get(hObject,'String'))+inj_offset;
0594 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigTimeDelay',delay);
0595 
0596 % --- Executes during object creation, after setting all properties.
0597 function boo_nod_CreateFcn(hObject, eventdata, handles)
0598 % hObject    handle to boo_nod (see GCBO)
0599 % eventdata  reserved - to be defined in a future version of MATLAB
0600 % handles    empty - handles not created until after all CreateFcns called
0601 
0602 % Hint: edit controls usually have a white background on Windows.
0603 %       See ISPC and COMPUTER.
0604 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0605     set(hObject,'BackgroundColor','white');
0606 end
0607 
0608 
0609 
0610 function boo_dcct_Callback(hObject, eventdata, handles)
0611 % hObject    handle to boo_dcct (see GCBO)
0612 % eventdata  reserved - to be defined in a future version of MATLAB
0613 % handles    structure with handles and user data (see GUIDATA)
0614 
0615 % Hints: get(hObject,'String') returns contents of boo_dcct as text
0616 %        str2double(get(hObject,'String')) returns contents of boo_dcct as a double
0617 inj_offset=str2double(get(handles.inj_offset,'String'));
0618 delay=str2double(get(hObject,'String'))+inj_offset;
0619 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booTimeDelay',delay);
0620 
0621 % --- Executes during object creation, after setting all properties.
0622 function boo_dcct_CreateFcn(hObject, eventdata, handles)
0623 % hObject    handle to boo_dcct (see GCBO)
0624 % eventdata  reserved - to be defined in a future version of MATLAB
0625 % handles    empty - handles not created until after all CreateFcns called
0626 
0627 % Hint: edit controls usually have a white background on Windows.
0628 %       See ISPC and COMPUTER.
0629 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0630     set(hObject,'BackgroundColor','white');
0631 end
0632 
0633 
0634 
0635 function lin_canon_spm_fin_Callback(hObject, eventdata, handles)
0636 % hObject    handle to lin_canon_spm_fin (see GCBO)
0637 % eventdata  reserved - to be defined in a future version of MATLAB
0638 % handles    structure with handles and user data (see GUIDATA)
0639 
0640 % Hints: get(hObject,'String') returns contents of lin_canon_spm_fin as text
0641 %        str2double(get(hObject,'String')) returns contents of lin_canon_spm_fin as a double
0642 
0643 inj_offset=str2double(get(handles.inj_offset,'String'));
0644 ext_offset=str2double(get(handles.ext_offset,'String'));
0645 lin_fin   =str2double(get(handles.lin_canon_spm_fin,'String'));
0646 save('synchro_offset_lin', 'inj_offset' , 'ext_offset', 'lin_fin');
0647 
0648 % --- Executes during object creation, after setting all properties.
0649 function lin_canon_spm_fin_CreateFcn(hObject, eventdata, handles)
0650 % hObject    handle to lin_canon_spm_fin (see GCBO)
0651 % eventdata  reserved - to be defined in a future version of MATLAB
0652 % handles    empty - handles not created until after all CreateFcns called
0653 
0654 % Hint: edit controls usually have a white background on Windows.
0655 %       See ISPC and COMPUTER.
0656 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0657     set(hObject,'BackgroundColor','white');
0658 end
0659 
0660 
0661 
0662 function central_pc_Callback(hObject, eventdata, handles)
0663 % hObject    handle to central_pc (see GCBO)
0664 % eventdata  reserved - to be defined in a future version of MATLAB
0665 % handles    structure with handles and user data (see GUIDATA)
0666 
0667 % Hints: get(hObject,'String') returns contents of central_pc as text
0668 %        str2double(get(hObject,'String')) returns contents of central_pc as a double
0669 
0670 delay=str2double(get(hObject,'String'));
0671 tango_write_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay',delay);
0672 
0673 %status soft checked on linac
0674 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
0675 if (temp.value(1)==2)
0676    %
0677 elseif (temp.value(1)==5)
0678     dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
0679     inj_offset=str2double(get(handles.inj_offset,'String'));
0680     dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay');
0681     delay=dt.value(1)-dt1.value(1)+inj_offset;
0682     tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
0683     temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
0684     set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
0685 end
0686 
0687 % --- Executes during object creation, after setting all properties.
0688 function central_pc_CreateFcn(hObject, eventdata, handles)
0689 % hObject    handle to central_pc (see GCBO)
0690 % eventdata  reserved - to be defined in a future version of MATLAB
0691 % handles    empty - handles not created until after all CreateFcns called
0692 
0693 % Hint: edit controls usually have a white background on Windows.
0694 %       See ISPC and COMPUTER.
0695 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0696     set(hObject,'BackgroundColor','white');
0697 end
0698 
0699 
0700 
0701 function central_inj_Callback(hObject, eventdata, handles)
0702 % hObject    handle to central_inj (see GCBO)
0703 % eventdata  reserved - to be defined in a future version of MATLAB
0704 % handles    structure with handles and user data (see GUIDATA)
0705 
0706 % Hints: get(hObject,'String') returns contents of central_inj as text
0707 %        str2double(get(hObject,'String')) returns contents of central_inj as a double
0708 
0709 delay=str2double(get(hObject,'String'));
0710 tango_write_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay',delay);
0711 
0712 % --- Executes during object creation, after setting all properties.
0713 function central_inj_CreateFcn(hObject, eventdata, handles)
0714 % hObject    handle to central_inj (see GCBO)
0715 % eventdata  reserved - to be defined in a future version of MATLAB
0716 % handles    empty - handles not created until after all CreateFcns called
0717 
0718 % Hint: edit controls usually have a white background on Windows.
0719 %       See ISPC and COMPUTER.
0720 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0721     set(hObject,'BackgroundColor','white');
0722 end
0723 
0724 
0725 
0726 
0727 function central_soft_Callback(hObject, eventdata, handles)
0728 % hObject    handle to central_soft (see GCBO)
0729 % eventdata  reserved - to be defined in a future version of MATLAB
0730 % handles    structure with handles and user data (see GUIDATA)
0731 
0732 % Hints: get(hObject,'String') returns contents of central_soft as text
0733 %        str2double(get(hObject,'String')) returns contents of central_soft as a double
0734 
0735 delay=str2double(get(hObject,'String'));
0736 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay',delay);
0737 
0738 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
0739 clkinj=int32(temp.value(1)+5*52);
0740 clkext=int32(temp.value(1)/52+10);
0741 tango_write_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay',clkinj);
0742 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue',clkext);
0743 
0744 %status soft checked on linac
0745 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareEvent');
0746 if (temp.value(1)==2)
0747    %
0748 elseif (temp.value(1)==1)
0749     dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
0750     inj_offset=str2double(get(handles.inj_offset,'String'));
0751     dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay');
0752     delay=dt.value(1)-dt1.value(1)+inj_offset;
0753     tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
0754     temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
0755     set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
0756 end
0757 
0758 % --- Executes during object creation, after setting all properties.
0759 function central_soft_CreateFcn(hObject, eventdata, handles)
0760 % hObject    handle to central_soft (see GCBO)
0761 % eventdata  reserved - to be defined in a future version of MATLAB
0762 % handles    empty - handles not created until after all CreateFcns called
0763 
0764 % Hint: edit controls usually have a white background on Windows.
0765 %       See ISPC and COMPUTER.
0766 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0767     set(hObject,'BackgroundColor','white');
0768 end
0769 
0770 
0771 % --- Executes on button press in button_acquisition_nooffset.
0772 function button_acquisition_nooffset_Callback(hObject, eventdata, handles)
0773 % hObject    handle to button_acquisition_nooffset (see GCBO)
0774 % eventdata  reserved - to be defined in a future version of MATLAB
0775 % handles    structure with handles and user data (see GUIDATA)
0776 
0777 set(handles.inj_offset,'Enable','off');
0778 set(handles.sdc1,'Enable','off');
0779 set(handles.lin_canon_lpm,'Enable','off');
0780 set(handles.lin_canon_spm,'Enable','off');
0781 set(handles.lin_canon_spm_fin,'Enable','off');
0782 set(handles.boo_bpm,'Enable','off');
0783 set(handles.lt1_emittance,'Enable','off');
0784 set(handles.lt1_MC1,'Enable','off');
0785 set(handles.lt1_MC2,'Enable','off');
0786 set(handles.lt1_osc,'Enable','off');
0787 set(handles.boo_dcct,'Enable','off');
0788 set(handles.boo_nod,'Enable','off');
0789 set(handles.boo_inj_septum,'Enable','off');
0790 set(handles.boo_inj_kicker,'Enable','off');
0791 set(handles.boo_alim_dipole,'Enable','off');
0792 set(handles.boo_alim_qf,'Enable','off');
0793 set(handles.boo_alim_qd,'Enable','off');
0794 set(handles.boo_alim_sf,'Enable','off');
0795 set(handles.boo_alim_sd,'Enable','off');
0796 set(handles.boo_rf,'Enable','off');
0797 set(handles.lin_modulateur,'Enable','off');
0798 set(handles.ext_offset,'Enable','off');
0799 set(handles.boo_ext_dof,'Enable','off');
0800 set(handles.boo_ext_sept_p,'Enable','off');
0801 set(handles.boo_ext_sept_a,'Enable','off');
0802 set(handles.boo_ext_kicker,'Enable','off');
0803 set(handles.sdc2,'Enable','off');
0804 set(handles.lt2_emittance,'Enable','off');
0805 set(handles.lt2_osc,'Enable','off');
0806 set(handles.lt2_bpm,'Enable','off');
0807 set(handles.ans_inj_k1,'Enable','off');
0808 set(handles.ans_inj_k2,'Enable','off');
0809 set(handles.ans_inj_k3,'Enable','off');
0810 set(handles.ans_inj_k4,'Enable','off');
0811 set(handles.ans_inj_sept_p,'Enable','off');
0812 set(handles.ans_inj_sept_a,'Enable','off');
0813 set(handles.ans_bpm,'Enable','off');
0814 set(handles.ans_dcct,'Enable','off');
0815 set(handles.ans_bpm_c01,'Enable','off');
0816 set(handles.ans_bpm_c02,'Enable','off');
0817 set(handles.ans_bpm_c03,'Enable','off');
0818 set(handles.ans_bpm_c04,'Enable','off');
0819 set(handles.ans_bpm_c05,'Enable','off');
0820 set(handles.ans_bpm_c06,'Enable','off');
0821 set(handles.ans_bpm_c07,'Enable','off');
0822 set(handles.ans_bpm_c08,'Enable','off');
0823 set(handles.ans_bpm_c09,'Enable','off');
0824 set(handles.ans_bpm_c10,'Enable','off');
0825 set(handles.ans_bpm_c11,'Enable','off');
0826 set(handles.ans_bpm_c12,'Enable','off');
0827 set(handles.ans_bpm_c13,'Enable','off');
0828 set(handles.ans_bpm_c14,'Enable','off');
0829 set(handles.ans_bpm_c15,'Enable','off');
0830 set(handles.ans_bpm_c16,'Enable','off');
0831 
0832 
0833 n=1;
0834 
0835 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay');
0836 set(handles.central_pc,'String',num2str(temp.value(n)));
0837 
0838 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
0839 set(handles.central_inj,'String',num2str(temp.value(n)));
0840 
0841 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
0842 set(handles.central_soft,'String',num2str(temp.value(n)));
0843 
0844 temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue');
0845 set(handles.central_ext,'String',num2str(temp.value(n)));
0846 
0847 
0848 temp=tango_read_attribute2('ANS/SY/LOCAL.SDC.1', 'oscTimeDelay');
0849 set(handles.sdc1,'String',num2str(temp.value(n)));
0850 
0851 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmTimeDelay');
0852 set(handles.lin_canon_lpm,'String',num2str(temp.value(n)));
0853 
0854 temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacTimeDelay');
0855 set(handles.lin_canon_spm,'String',num2str(temp.value(n)));
0856 
0857 
0858 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigTimeDelay');
0859 set(handles.boo_bpm,'String',num2str(temp.value(n)));
0860 
0861 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceTimeDelay');
0862 set(handles.lt1_emittance,'String',num2str(temp.value(n)));
0863 
0864 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1TimeDelay');
0865 set(handles.lt1_MC1,'String',num2str(temp.value(n)));
0866 
0867 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2TimeDelay');
0868 set(handles.lt1_MC2,'String',num2str(temp.value(n)));
0869 
0870 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'oscTimeDelay');
0871 set(handles.lt1_osc,'String',num2str(temp.value(n)));
0872 
0873 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booTimeDelay');
0874 set(handles.boo_dcct,'String',num2str(temp.value(n)));
0875 
0876 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigTimeDelay');
0877 set(handles.boo_nod,'String',num2str(temp.value(n)));
0878 
0879 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigTimeDelay');
0880 set(handles.boo_inj_septum,'String',num2str(temp.value(n)));
0881 
0882 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigTimeDelay');
0883 set(handles.boo_inj_kicker,'String',num2str(temp.value(n)));
0884 
0885 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'dpTimeDelay');
0886 set(handles.boo_alim_dipole,'String',num2str(temp.value(n)));
0887 
0888 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTimeDelay');
0889 set(handles.boo_alim_qf,'String',num2str(temp.value(n)));
0890 
0891 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTimeDelay');
0892 set(handles.boo_alim_qd,'String',num2str(temp.value(n)));
0893 
0894 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'sfTimeDelay');
0895 set(handles.boo_alim_sf,'String',num2str(temp.value(n)));
0896 
0897 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'sdTimeDelay');
0898 set(handles.boo_alim_sd,'String',num2str(temp.value(n)));
0899 
0900 temp=tango_read_attribute2('BOO/SY/LOCAL.RF.1', 'rfTimeDelay');
0901 set(handles.boo_rf,'String',num2str(temp.value(n)));
0902 
0903 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
0904 set(handles.lin_modulateur,'String',num2str(temp.value(n)));
0905 
0906 
0907 
0908 
0909 
0910 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTimeDelay');
0911 set(handles.boo_ext_dof,'String',num2str(temp.value(n)));
0912 
0913 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTimeDelay');
0914 set(handles.boo_ext_sept_p,'String',num2str(temp.value(n)));
0915 
0916 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTimeDelay');
0917 set(handles.boo_ext_sept_a,'String',num2str(temp.value(n)));
0918 
0919 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTimeDelay');
0920 set(handles.boo_ext_kicker,'String',num2str(temp.value(n)));
0921 
0922 
0923 temp=tango_read_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTimeDelay');
0924 set(handles.sdc2,'String',num2str(temp.value(n)));
0925 
0926 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTimeDelay');
0927 set(handles.lt2_emittance,'String',num2str(temp.value(n)));
0928 
0929 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTimeDelay');
0930 set(handles.lt2_osc,'String',num2str(temp.value(n)));
0931 
0932 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTimeDelay');
0933 set(handles.lt2_bpm,'String',num2str(temp.value(n)));
0934 
0935 
0936 
0937 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTimeDelay');
0938 set(handles.ans_inj_k1,'String',num2str(temp.value(n)));
0939 
0940 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTimeDelay');
0941 set(handles.ans_inj_k2,'String',num2str(temp.value(n)));
0942 
0943 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTimeDelay');
0944 set(handles.ans_inj_k3,'String',num2str(temp.value(n)));
0945 
0946 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTimeDelay');
0947 set(handles.ans_inj_k4,'String',num2str(temp.value(n)));
0948 
0949 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTimeDelay');
0950 set(handles.ans_inj_sept_p,'String',num2str(temp.value(n)));
0951 
0952 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTimeDelay');
0953 set(handles.ans_inj_sept_a,'String',num2str(temp.value(n)));
0954 
0955 temp=tango_read_attribute2('ANS-C13/SY/LOCAL.DG.1', 'dcctTimeDelay');
0956 set(handles.ans_dcct,'String',num2str(temp.value(n)));
0957 
0958 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTimeDelay');
0959 set(handles.ans_bpm,'String',num2str(temp.value(n)));
0960 set(handles.ans_bpm_c01,'String',num2str(temp.value(n)));
0961 
0962 
0963 temp=tango_read_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0964 set(handles.ans_bpm_c02,'String',num2str(temp.value(n)));
0965 temp=tango_read_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0966 set(handles.ans_bpm_c03,'String',num2str(temp.value(n)));
0967 temp=tango_read_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0968 set(handles.ans_bpm_c04,'String',num2str(temp.value(n)));
0969 temp=tango_read_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0970 set(handles.ans_bpm_c05,'String',num2str(temp.value(n)));
0971 temp=tango_read_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0972 set(handles.ans_bpm_c06,'String',num2str(temp.value(n)));
0973 temp=tango_read_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0974 set(handles.ans_bpm_c07,'String',num2str(temp.value(n)));
0975 temp=tango_read_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0976 set(handles.ans_bpm_c08,'String',num2str(temp.value(n)));
0977 temp=tango_read_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0978 set(handles.ans_bpm_c09,'String',num2str(temp.value(n)));
0979 temp=tango_read_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0980 set(handles.ans_bpm_c10,'String',num2str(temp.value(n)));
0981 temp=tango_read_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0982 set(handles.ans_bpm_c11,'String',num2str(temp.value(n)));
0983 temp=tango_read_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0984 set(handles.ans_bpm_c12,'String',num2str(temp.value(n)));
0985 temp=tango_read_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0986 set(handles.ans_bpm_c13,'String',num2str(temp.value(n)));
0987 temp=tango_read_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0988 set(handles.ans_bpm_c14,'String',num2str(temp.value(n)));
0989 temp=tango_read_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0990 set(handles.ans_bpm_c15,'String',num2str(temp.value(n)));
0991 temp=tango_read_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
0992 set(handles.ans_bpm_c16,'String',num2str(temp.value(n)));
0993 
0994 
0995 
0996 %status soft checked on linac
0997 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
0998 if (temp.value(n)==2)
0999     %set(handles.soft_button,'Value',0);
1000 elseif (temp.value(n)==5)
1001     %set(handles.soft_button,'Value',1);
1002 end
1003 
1004 %status tables
1005 temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
1006 offset=temp.value(1)*52;
1007 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
1008 n=temp.value;
1009 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
1010 table=temp.value(1:n)-offset;
1011 set(handles.edit_filling_relecture_tables,'String',['T=' , num2str(table)]);  
1012 
1013 
1014 
1015 % --- Executes on button press in button_acquisition_delay.
1016 function button_acquisition_delay_Callback(hObject, eventdata, handles)
1017 % hObject    handle to button_acquisition_delay (see GCBO)
1018 % eventdata  reserved - to be defined in a future version of MATLAB
1019 % handles    structure with handles and user data (see GUIDATA)
1020 
1021 
1022 set(handles.inj_offset,'Enable','on');
1023 set(handles.sdc1,'Enable','on');
1024 set(handles.lin_canon_lpm,'Enable','on');
1025 set(handles.lin_canon_spm,'Enable','on');
1026 set(handles.lin_canon_spm_fin,'Enable','on');
1027 set(handles.boo_bpm,'Enable','on');
1028 set(handles.lt1_emittance,'Enable','on');
1029 set(handles.lt1_MC1,'Enable','on');
1030 set(handles.lt1_MC2,'Enable','on');
1031 set(handles.lt1_osc,'Enable','on');
1032 set(handles.boo_dcct,'Enable','on');
1033 set(handles.boo_nod,'Enable','on');
1034 set(handles.boo_inj_septum,'Enable','on');
1035 set(handles.boo_inj_kicker,'Enable','on');
1036 set(handles.boo_alim_dipole,'Enable','on');
1037 set(handles.boo_alim_qf,'Enable','on');
1038 set(handles.boo_alim_qd,'Enable','on');
1039 set(handles.boo_alim_sf,'Enable','on');
1040 set(handles.boo_alim_sd,'Enable','on');
1041 set(handles.boo_rf,'Enable','on');
1042 set(handles.lin_modulateur,'Enable','on');
1043 set(handles.ext_offset,'Enable','on');
1044 set(handles.boo_ext_dof,'Enable','on');
1045 set(handles.boo_ext_sept_p,'Enable','on');
1046 set(handles.boo_ext_sept_a,'Enable','on');
1047 set(handles.boo_ext_kicker,'Enable','on');
1048 set(handles.sdc2,'Enable','on');
1049 set(handles.lt2_emittance,'Enable','on');
1050 set(handles.lt2_osc,'Enable','on');
1051 set(handles.lt2_bpm,'Enable','on');
1052 set(handles.ans_inj_k1,'Enable','on');
1053 set(handles.ans_inj_k2,'Enable','on');
1054 set(handles.ans_inj_k3,'Enable','on');
1055 set(handles.ans_inj_k4,'Enable','on');
1056 set(handles.ans_inj_sept_p,'Enable','on');
1057 set(handles.ans_inj_sept_a,'Enable','on');
1058 set(handles.ans_bpm,'Enable','on');
1059 set(handles.ans_dcct,'Enable','on');
1060 set(handles.ans_bpm_c01,'Enable','on');
1061 set(handles.ans_bpm_c02,'Enable','on');
1062 set(handles.ans_bpm_c03,'Enable','on');
1063 set(handles.ans_bpm_c04,'Enable','on');
1064 set(handles.ans_bpm_c05,'Enable','on');
1065 set(handles.ans_bpm_c06,'Enable','on');
1066 set(handles.ans_bpm_c07,'Enable','on');
1067 set(handles.ans_bpm_c08,'Enable','on');
1068 set(handles.ans_bpm_c09,'Enable','on');
1069 set(handles.ans_bpm_c10,'Enable','on');
1070 set(handles.ans_bpm_c11,'Enable','on');
1071 set(handles.ans_bpm_c12,'Enable','on');
1072 set(handles.ans_bpm_c13,'Enable','on');
1073 set(handles.ans_bpm_c14,'Enable','on');
1074 set(handles.ans_bpm_c15,'Enable','on');
1075 set(handles.ans_bpm_c16,'Enable','on');
1076 
1077 load('synchro_offset_lin', 'inj_offset' , 'ext_offset', 'lin_fin');
1078 set(handles.inj_offset,'String',num2str(inj_offset));
1079 set(handles.ext_offset,'String',num2str(ext_offset));
1080 set(handles.lin_canon_spm_fin,'String',num2str(lin_fin));
1081 
1082 n=1;
1083 
1084 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay');
1085 set(handles.central_pc,'String',num2str(temp.value(n)));
1086 
1087 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1088 set(handles.central_inj,'String',num2str(temp.value(n)));
1089 
1090 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1091 set(handles.central_soft,'String',num2str(temp.value(n)));
1092 set(handles.central_soft1,'String',num2str(temp.value(n)));
1093 
1094 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue');
1095 set(handles.central_ext,'String',num2str(temp.value(n)));
1096 
1097 
1098 
1099 inj_offset=str2double(get(handles.inj_offset,'String'));
1100 
1101 temp=tango_read_attribute2('ANS/SY/LOCAL.SDC.1', 'oscTimeDelay');
1102 set(handles.sdc1,'String',num2str(temp.value(n)-inj_offset));
1103 
1104 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmTimeDelay');
1105 set(handles.lin_canon_lpm,'String',num2str(temp.value(n)-inj_offset));
1106 
1107 temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacTimeDelay');
1108 set(handles.lin_canon_spm,'String',num2str(temp.value(n)-inj_offset));
1109 
1110 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigTimeDelay');
1111 set(handles.boo_bpm,'String',num2str(temp.value(n)-inj_offset));
1112 
1113 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceTimeDelay');
1114 set(handles.lt1_emittance,'String',num2str(temp.value(n)-inj_offset));
1115 
1116 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1TimeDelay');
1117 set(handles.lt1_MC1,'String',num2str(temp.value(n)-inj_offset));
1118 
1119 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2TimeDelay');
1120 set(handles.lt1_MC2,'String',num2str(temp.value(n)-inj_offset));
1121 
1122 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'oscTimeDelay');
1123 set(handles.lt1_osc,'String',num2str(temp.value(n)-inj_offset));
1124 
1125 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booTimeDelay');
1126 set(handles.boo_dcct,'String',num2str(temp.value(n)-inj_offset));
1127 
1128 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigTimeDelay');
1129 set(handles.boo_nod,'String',num2str(temp.value(n)-inj_offset));
1130 
1131 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigTimeDelay');
1132 set(handles.boo_inj_septum,'String',num2str(temp.value(n)-inj_offset));
1133 
1134 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigTimeDelay');
1135 set(handles.boo_inj_kicker,'String',num2str(temp.value(n)-inj_offset));
1136 
1137 
1138 
1139 
1140 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'dpTimeDelay');
1141 set(handles.boo_alim_dipole,'String',num2str(temp.value(n)));
1142 
1143 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTimeDelay');
1144 set(handles.boo_alim_qf,'String',num2str(temp.value(n)));
1145 
1146 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTimeDelay');
1147 set(handles.boo_alim_qd,'String',num2str(temp.value(n)));
1148 
1149 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'sfTimeDelay');
1150 set(handles.boo_alim_sf,'String',num2str(temp.value(n)));
1151 
1152 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'sdTimeDelay');
1153 set(handles.boo_alim_sd,'String',num2str(temp.value(n)));
1154 
1155 temp=tango_read_attribute2('BOO/SY/LOCAL.RF.1', 'rfTimeDelay');
1156 set(handles.boo_rf,'String',num2str(temp.value(n)));
1157 
1158 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
1159 set(handles.lin_modulateur,'String',num2str(temp.value(n)-inj_offset));
1160 
1161 
1162 
1163 ext_offset=str2double(get(handles.ext_offset,'String'));
1164 
1165 
1166 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTimeDelay');
1167 set(handles.boo_ext_dof,'String',num2str(temp.value(n)-ext_offset));
1168 
1169 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTimeDelay');
1170 set(handles.boo_ext_sept_p,'String',num2str(temp.value(n)-ext_offset));
1171 
1172 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTimeDelay');
1173 set(handles.boo_ext_sept_a,'String',num2str(temp.value(n)-ext_offset));
1174 
1175 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTimeDelay');
1176 set(handles.boo_ext_kicker,'String',num2str(temp.value(n)-ext_offset));
1177 
1178 temp=tango_read_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTimeDelay');
1179 set(handles.sdc2,'String',num2str(temp.value(n)-ext_offset));
1180 
1181 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTimeDelay');
1182 set(handles.lt2_emittance,'String',num2str(temp.value(n)-ext_offset));
1183 
1184 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTimeDelay');
1185 set(handles.lt2_osc,'String',num2str(temp.value(n)-ext_offset));
1186 
1187 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTimeDelay');
1188 set(handles.lt2_bpm,'String',num2str(temp.value(n)-ext_offset));
1189 
1190 
1191 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTimeDelay');
1192 set(handles.ans_inj_k1,'String',num2str(temp.value(n)-ext_offset));
1193 
1194 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTimeDelay');
1195 set(handles.ans_inj_k2,'String',num2str(temp.value(n)-ext_offset));
1196 
1197 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTimeDelay');
1198 set(handles.ans_inj_k3,'String',num2str(temp.value(n)-ext_offset));
1199 
1200 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTimeDelay');
1201 set(handles.ans_inj_k4,'String',num2str(temp.value(n)-ext_offset));
1202 
1203 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTimeDelay');
1204 set(handles.ans_inj_sept_p,'String',num2str(temp.value(n)-ext_offset));
1205 
1206 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTimeDelay');
1207 set(handles.ans_inj_sept_a,'String',num2str(temp.value(n)-ext_offset));
1208 
1209 temp=tango_read_attribute2('ANS-C13/SY/LOCAL.DG.1', 'dcctTimeDelay');
1210 set(handles.ans_dcct,'String',num2str(temp.value(n)-ext_offset));
1211 
1212 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTimeDelay');
1213 set(handles.ans_bpm,'String',num2str(temp.value(n)-ext_offset));
1214 set(handles.ans_bpm_c01,'String',num2str(temp.value(n)-ext_offset));
1215 temp=tango_read_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1216 set(handles.ans_bpm_c02,'String',num2str(temp.value(n)-ext_offset));
1217 temp=tango_read_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1218 set(handles.ans_bpm_c03,'String',num2str(temp.value(n)-ext_offset));
1219 temp=tango_read_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1220 set(handles.ans_bpm_c04,'String',num2str(temp.value(n)-ext_offset));
1221 temp=tango_read_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1222 set(handles.ans_bpm_c05,'String',num2str(temp.value(n)-ext_offset));
1223 temp=tango_read_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1224 set(handles.ans_bpm_c06,'String',num2str(temp.value(n)-ext_offset));
1225 temp=tango_read_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1226 set(handles.ans_bpm_c07,'String',num2str(temp.value(n)-ext_offset));
1227 temp=tango_read_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1228 set(handles.ans_bpm_c08,'String',num2str(temp.value(n)-ext_offset));
1229 temp=tango_read_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1230 set(handles.ans_bpm_c09,'String',num2str(temp.value(n)-ext_offset));
1231 temp=tango_read_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1232 set(handles.ans_bpm_c10,'String',num2str(temp.value(n)-ext_offset));
1233 temp=tango_read_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1234 set(handles.ans_bpm_c11,'String',num2str(temp.value(n)-ext_offset));
1235 temp=tango_read_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1236 set(handles.ans_bpm_c12,'String',num2str(temp.value(n)-ext_offset));
1237 temp=tango_read_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1238 set(handles.ans_bpm_c13,'String',num2str(temp.value(n)-ext_offset));
1239 temp=tango_read_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1240 set(handles.ans_bpm_c14,'String',num2str(temp.value(n)-ext_offset));
1241 temp=tango_read_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1242 set(handles.ans_bpm_c15,'String',num2str(temp.value(n)-ext_offset));
1243 temp=tango_read_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTimeDelay');
1244 set(handles.ans_bpm_c16,'String',num2str(temp.value(n)-ext_offset));
1245 
1246 %status soft checked on linac
1247 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
1248 if (temp.value(n)==2)
1249     %set(handles.soft_button,'Value',0);
1250 elseif (temp.value(n)==5)
1251     %set(handles.uipanel_mode,'String','Mode Soft');
1252 end
1253 
1254 %status tables
1255 %temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
1256 %offset=temp.value(1)*52;
1257 offset_linac=10*lin_fin;
1258 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
1259 n=temp.value;
1260 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
1261 table_ext=temp.value(1:n); %-offset_ext;
1262 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'LinacDelayTable');
1263 table_linac=(temp.value(1:n)-offset_linac)/28;
1264 table=[];
1265 for i=1:n
1266     table=[table ' ' '(' num2str([table_ext(i)])  ' '  num2str([table_linac(i)]) ')'];
1267 end
1268 set(handles.edit_filling_relecture_tables,'String',[num2str(table)]);
1269 set(handles.edit_filling_relecture_bunch, 'String','??');
1270 
1271 
1272 
1273 % --- Executes on button press in button_injection_soft.
1274 function button_injection_soft_Callback(hObject, eventdata, handles)
1275 % hObject    handle to button_injection_soft (see GCBO)
1276 % eventdata  reserved - to be defined in a future version of MATLAB
1277 % handles    structure with handles and user data (see GUIDATA)
1278 
1279 set(handles.button_injection_soft,'Enable','Off')
1280 offset_linac=10*str2double(get(handles.lin_canon_spm_fin,'String'));% délai fin de réglage en pas de 100 ps
1281 modeinj=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');      % mode soft ou 3Hz
1282 modefill=get(handles.listbox_fillingmode,'Value');                  % mode de remplissage
1283 handles.table
1284 [clk_pc,clk_soft]=fix_quart;
1285 handles.clk_pc =clk_pc;
1286 handles.clk_soft=clk_soft;
1287 
1288 dt=1.5; % délais pour acquisitions rendements
1289 %Inialise data pour les rendements
1290 temp=tango_read_attribute2('ANS-C03/DG/DCCT','current');anscur0=temp.value;
1291 q1=0;q2=0;n=0;
1292 
1293 
1294 modeinj='k';
1295 if strcmp(modeinj,'togglebutton_soft')
1296     boucle=int16(str2double(get(handles.edit_Nshot_soft,'String')));  
1297     modeinj='Injection soft';
1298     if (modefill<=4) % LPM
1299         for k=1:boucle
1300             i=int16(modefill);
1301             clk1=handles.clk_pc(i);
1302             clk2=handles.clk_soft(i);
1303             tango_write_attribute2('ANS/SY/CENTRAL', 'TPcStepDelay',clk1);
1304             tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',clk2);
1305             tango_command_inout('ANS/SY/CENTRAL','FireSoftEvent');
1306             pause(dt)
1307             [q1,q2,n]=getcharge(q1,q2,n);
1308         end
1309     elseif (modefill>4)&&(modefill<=7) %LPM
1310         for k=1:boucle
1311             for i=1:(modefill-3)
1312                 clk1=handles.clk_pc(i);
1313                 clk2=handles.clk_soft(i);
1314                 tango_write_attribute2('ANS/SY/CENTRAL', 'TPcStepDelay',clk1);
1315                 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',clk2);
1316                 tango_command_inout('ANS/SY/CENTRAL','FireSoftEvent');
1317                 pause(dt)
1318                 [q1,q2,n]=getcharge(q1,q2,n);
1319             end
1320         end    
1321     elseif (modefill==8)   % LPM
1322         for k=1:boucle
1323             clk1=handles.clk_pc(1);
1324             clk2=handles.clk_soft(1);
1325             bunch=1 + (0:12)*32;
1326             [dtour,dpaquet]=bucketnumber(bunch);    
1327             clk_pc  =int32(dtour) +  int32(clk1);
1328             clk_soft=int32(dtour)  + int32(clk2);
1329             for i=1:13
1330                 tango_write_attribute2('ANS/SY/CENTRAL', 'TPcStepDelay',clk_pc(i));
1331                 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',clk_soft(i));
1332                 tango_command_inout('ANS/SY/CENTRAL','FireSoftEvent');
1333                 pause(dt)
1334                 [q1,q2,n]=getcharge(q1,q2,n);
1335             end
1336         end   
1337     elseif (modefill>=9) %SPM
1338         clk1=handles.clk_pc(1);
1339         clk2=handles.clk_soft(1);
1340         table=handles.table;
1341         nb=table(1);
1342         dtour=table(2:1+nb);
1343         paq  =table(2+nb:1+2*nb);
1344         clk_pc  =int32(dtour) +  int32(clk1);
1345         clk_soft=int32(dtour)  + int32(clk2);    
1346         for k=1:boucle
1347             for i=1:nb  
1348                 table=int32([1 0 paq(i)]);
1349                 tango_command_inout('ANS/SY/CENTRAL','SetTables',table); pause(0.2)  ;             
1350                 tango_write_attribute2('ANS/SY/CENTRAL', 'TPcStepDelay',clk_pc(i));
1351                 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',clk_soft(i));
1352                 tango_command_inout('ANS/SY/CENTRAL','FireSoftEvent');
1353                 pause(dt)
1354                 [q1,q2,n]=getcharge(q1,q2,n);
1355             end 
1356         end           
1357     end
1358     
1359     clk1=handles.clk_pc(1);
1360     clk2=handles.clk_soft(1);
1361     tango_write_attribute2('ANS/SY/CENTRAL', 'TPcStepDelay',clk1);
1362     tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',clk2);
1363     
1364     % Calcul des rendements
1365     pause(1);
1366     temp=tango_read_attribute2('ANS-C03/DG/DCCT','current');anscur=temp.value;
1367     dcur=anscur-anscur0;
1368     r1=0;if (q1~=0);r1=q2/q1*100;end
1369     r2=0;if (q2~=0);r2=dcur/q2*0.524*416/184*100;end
1370     if(r1<0);r1=0;elseif(r1>100);r1=100;end
1371     if(r2<0);r2=0;elseif(r2>100);r2=100;end
1372     q1=q1/n;q2=q2/n;  
1373 
1374     set(handles.edit_qlt1,'String',num2str(q1,'%5.2f'));
1375     set(handles.edit_iboo,'String',num2str(q2/0.524,'%5.2f'));
1376     set(handles.edit_dians,'String',num2str(dcur/n,'%5.2f'));
1377     set(handles.edit_rboo,'String',num2str(int16(r1)));
1378     set(handles.edit_rans,'String',num2str(int16(r2)));
1379     set(handles.edit_cycle,'String',num2str(n,'%g'));
1380     set(handles.edit_dians1,'String',num2str(dcur,'%5.2f'));
1381     set(handles.edit_courant_total,'String', num2str(anscur,'%5.2f'));
1382     
1383     temp=tango_read_attribute2('ANS/DG/BPM-tunex','Nu'); nux=temp.value;
1384     temp=tango_read_attribute2('ANS/DG/BPM-tunez','Nu'); nuz=temp.value;
1385     temp=tango_read_attribute2('ANS-C03/RF/lle.1','voltageRF');v1=temp.value(2);
1386     temp=tango_read_attribute2('ANS-C03/RF/lle.2','voltageRF');v2=temp.value(2);
1387     vrf=(v1+v2)/1000;
1388 
1389     fprintf('%s   %s  Remplissage = %d     Rendements=%5.2f %5.2f    Tunes=%5.2f %5.2f    Vrf=%5.2f \n',datestr(clock),modeinj,modefill,r1,r2, nux,nuz,vrf);
1390     
1391     
1392 elseif strcmp(modeinj,'togglebutton_3Hz')
1393     
1394     modelinac=get(get(handles.uipanel_lpm_spm_mode,'SelectedObject'),'Tag');
1395     switch modelinac  % Get Tag of selected object
1396         case 'no_mode'
1397             event=[0 0];
1398         case 'lpm_mode'
1399             event=[2 0];
1400         case 'spm_mode'
1401             event=[0 2];
1402     end
1403     
1404     modeinj='Injection 3 Hz';
1405     laps=str2double(get(handles.edit_laps,'String'));
1406     fprintf('%s   %s  Remplissage = %d\n',datestr(clock),modeinj,modefill);
1407     start_3Hz(event)
1408     pause(laps)
1409     stop_3Hz
1410     
1411     pause(1);
1412     [q1,q2,n]=getcharge(q1,q2,n);
1413     temp=tango_read_attribute2('ANS-C03/DG/DCCT','current');anscur=temp.value;
1414     dcur=anscur-anscur0;
1415     n=int16(laps/0.340);
1416     r1=0;if (q1~=0);r1=int16(q2/q1*100);end
1417     r2=0;if (q2~=0);r2=int16(dcur/n/q2*0.524*416/184*100);end
1418     if(r1<0);r1=0;elseif(r1>100);r1=100;end
1419     if(r2<0);r2=0;elseif(r2>100);r2=100;end
1420     
1421     set(handles.edit_qlt1,'String',num2str(q1,'%5.2f'));
1422     set(handles.edit_iboo,'String',num2str(q2/0.524,'%5.2f'));
1423     set(handles.edit_dians,'String',num2str(dcur/n,'%5.2f'));
1424     set(handles.edit_rboo,'String',num2str(r1));
1425     set(handles.edit_rans,'String',num2str(r2));
1426     set(handles.edit_cycle,'String',num2str(n,'%g'));
1427     set(handles.edit_dians1,'String',num2str(dcur,'%5.2f'));
1428     set(handles.edit_courant_total,'String', num2str(anscur,'%5.2f'));
1429 
1430 end
1431 
1432 
1433 
1434 set(handles.button_injection_soft,'Enable','On');
1435 
1436 
1437 function periode_edit_Callback(hObject, eventdata, handles)
1438 % hObject    handle to periode_edit (see GCBO)
1439 % eventdata  reserved - to be defined in a future version of MATLAB
1440 % handles    structure with handles and user data (see GUIDATA)
1441 
1442 % Hints: get(hObject,'String') returns contents of periode_edit as text
1443 %        str2double(get(hObject,'String')) returns contents of periode_edit as a double
1444 
1445 val_multishot = get(handles.on1,'Value');
1446 
1447 if val_multishot
1448     errordlg('positionner le trigger a OFF !','Attention');
1449     return
1450 else
1451     handles.periode = str2double(get(hObject,'String'));
1452 
1453     % change timer Infinite loop
1454     timer1=timer('StartDelay',1,...
1455         'ExecutionMode','fixedRate','Period',handles.periode,'TasksToExecute',Inf);
1456     timer1.TimerFcn = {@fonction_alex, hObject,eventdata, handles};
1457     setappdata(handles.figure1,'Timer',timer1);
1458 
1459     % Update handles structure
1460     guidata(hObject, handles);
1461 end
1462 
1463 
1464 % --- Executes during object creation, after setting all properties.
1465 function periode_edit_CreateFcn(hObject, eventdata, handles)
1466 % hObject    handle to periode_edit (see GCBO)
1467 % eventdata  reserved - to be defined in a future version of MATLAB
1468 % handles    empty - handles not created until after all CreateFcns called
1469 
1470 % Hint: edit controls usually have a white background on Windows.
1471 %       See ISPC and COMPUTER.
1472 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1473     set(hObject,'BackgroundColor','white');
1474 end
1475 
1476 function uibuttongroup_SelectionChangeFcn(hObject,eventdata,handles)
1477 % hObject    handle to uipanel1 (see GCBO)
1478 % eventdata  reserved - to be defined in a future version of MATLAB
1479 % handles    structure with handles and user data (see GUIDATA)
1480 
1481 timer1 = getappdata(handles.figure1,'Timer1')
1482 timer2 = getappdata(handles.figure1,'Timer2');
1483 handles = guidata(gcbo);
1484 
1485 switch get(get(hObject,'SelectedObject'),'Tag')  % Get Tag of selected object
1486     case 'radiobutton1'
1487         % stop du trigger
1488         stop(timer1);
1489         stop(timer2);
1490     case 'radiobutton2'
1491         % démarrage  du trigger 1
1492         start(timer1);
1493     case 'radiobutton3'
1494         % démarrage du trigger 2
1495         temp=tango_read_attribute2('ANS-C03/DG/DCCT','current');anscur=temp.value;
1496         if (anscur>1.) 
1497            start(timer2);      
1498         else
1499             % ne fait rien, en cas de perte faisceau
1500         end  
1501 end
1502 
1503 
1504 function fonction_alex1(arg1,arg2,hObject,eventdata,handles)
1505 % hObject    handle to uipanel1 (see GCBO)
1506 % eventdata  reserved - to be defined in a future version of MATLAB
1507 % handles    structure with handles and user data (see GUIDATA)
1508 
1509 
1510 button_injection_soft_Callback(hObject,eventdata,handles)
1511 
1512 
1513 function fonction_alex2(arg1,arg2,hObject,eventdata,handles)
1514 % hObject    handle to uipanel1 (see GCBO)
1515 % eventdata  reserved - to be defined in a future version of MATLAB
1516 % handles    structure with handles and user data (see GUIDATA)
1517 
1518 
1519 temp=tango_read_attribute2('ANS-C03/DG/DCCT','current');anscur=temp.value;
1520 set(handles.edit_courant_total,'String', num2str(anscur,'%5.2f'));
1521 Imin=str2double(get(handles.edit_Imin,'String'));
1522 
1523 
1524 if     (anscur>Imin)
1525    % on attend
1526    %fprintf('Cur = %g \n',anscur)
1527 else
1528   % inject le cycle en cours
1529   %fprintf('Cur = %g : Injection \n',anscur)
1530   button_injection_soft_Callback(hObject, eventdata, handles)
1531 end   
1532 
1533 
1534 
1535 %% What to do before closing the application
1536 function Closinggui(obj, event, handles, figure1)
1537 
1538 % Get default command line output from handles structure
1539 answer = questdlg('Fermer softsynchro ?',...
1540     'Exit softsynchro',...
1541     'Yes','No','Yes');
1542 
1543 switch answer
1544     case 'Yes'           
1545         delete(handles); %Delete Timer
1546         delete(figure1); %Close gui
1547     otherwise
1548         disp('Closing aborted')
1549 end
1550 
1551 
1552 
1553 % --- Executes on button press in button_softmoins.
1554 function button_softmoins_Callback(hObject, eventdata, handles)
1555 % hObject    handle to button_softmoins (see GCBO)
1556 % eventdata  reserved - to be defined in a future version of MATLAB
1557 % handles    structure with handles and user data (see GUIDATA)
1558 
1559 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1560 step=temp.value(1)-51*0.52243;
1561 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay',step);
1562 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1563 set(handles.central_soft,'String',num2str(temp.value(1)));
1564 
1565 % decale adress inj et extract d'une super-periode
1566 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
1567 clkinj=int32(temp.value(1)+5*52);
1568 clkext=int32(temp.value(1)/52+10);
1569 tango_write_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay',clkinj);
1570 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue',clkext);
1571 
1572 %status soft checked on linac
1573 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareEvent');
1574 if (temp.value(1)==2)
1575    %
1576 elseif (temp.value(1)==1)
1577     dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1578     inj_offset=str2double(get(handles.inj_offset,'String'));
1579     dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay');
1580     delay=dt.value(1)-dt1.value(1)+inj_offset;
1581     tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1582     temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
1583     set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
1584 end
1585 
1586 
1587 % --- Executes on button press in button_softplus.
1588 function button_softplus_Callback(hObject, eventdata, handles)
1589 % hObject    handle to button_softplus (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 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1594 step=temp.value(1)+52*0.52243;
1595 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay',step);
1596 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1597 set(handles.central_soft,'String',num2str(temp.value(1)));
1598 
1599 % dcale adress inj et extract d'une super-periode
1600 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
1601 clkinj=int32(temp.value(1)+5*52);
1602 clkext=int32(temp.value(1)/52+10);
1603 tango_write_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay',clkinj);
1604 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue',clkext);
1605 
1606 %status soft checked on linac
1607 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareEvent');
1608 if (temp.value(1)==2)
1609    %
1610 elseif (temp.value(1)==1)
1611     dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1612     inj_offset=str2double(get(handles.inj_offset,'String'));
1613     dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay');
1614     delay=dt.value(1)-dt1.value(1)+inj_offset;
1615     tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1616     temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
1617     set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
1618 end
1619 
1620 
1621 % --- Executes on button press in button_injmoins.
1622 function button_injmoins_Callback(hObject, eventdata, handles)
1623 % hObject    handle to button_injmoins (see GCBO)
1624 % eventdata  reserved - to be defined in a future version of MATLAB
1625 % handles    structure with handles and user data (see GUIDATA)
1626 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1627 step=temp.value(1)-51*0.52243;
1628 tango_write_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay',step);
1629 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1630 set(handles.central_inj,'String',num2str(temp.value(1)));
1631 
1632 
1633 
1634 % --- Executes on button press in button_injplus.
1635 function button_injplus_Callback(hObject, eventdata, handles)
1636 % hObject    handle to button_injplus (see GCBO)
1637 % eventdata  reserved - to be defined in a future version of MATLAB
1638 % handles    structure with handles and user data (see GUIDATA)
1639 
1640 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1641 step=temp.value(1)+52*0.52243;
1642 tango_write_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay',step);
1643 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1644 set(handles.central_inj,'String',num2str(temp.value(1)));
1645 
1646 
1647 
1648 function boo_ext_dof_Callback(hObject, eventdata, handles)
1649 % hObject    handle to boo_ext_dof (see GCBO)
1650 % eventdata  reserved - to be defined in a future version of MATLAB
1651 % handles    structure with handles and user data (see GUIDATA)
1652 
1653 % Hints: get(hObject,'String') returns contents of boo_ext_dof as text
1654 %        str2double(get(hObject,'String')) returns contents of boo_ext_dof as a double
1655 ext_offset=str2double(get(handles.ext_offset,'String'));
1656 delay=str2double(get(hObject,'String'))+ext_offset;
1657 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTimeDelay',delay);
1658 
1659 % --- Executes during object creation, after setting all properties.
1660 function boo_ext_dof_CreateFcn(hObject, eventdata, handles)
1661 % hObject    handle to boo_ext_dof (see GCBO)
1662 % eventdata  reserved - to be defined in a future version of MATLAB
1663 % handles    empty - handles not created until after all CreateFcns called
1664 
1665 % Hint: edit controls usually have a white background on Windows.
1666 %       See ISPC and COMPUTER.
1667 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1668     set(hObject,'BackgroundColor','white');
1669 end
1670 
1671 
1672 
1673 function boo_ext_sept_p_Callback(hObject, eventdata, handles)
1674 % hObject    handle to boo_ext_sept_p (see GCBO)
1675 % eventdata  reserved - to be defined in a future version of MATLAB
1676 % handles    structure with handles and user data (see GUIDATA)
1677 
1678 % Hints: get(hObject,'String') returns contents of boo_ext_sept_p as text
1679 %        str2double(get(hObject,'String')) returns contents of boo_ext_sept_p as a double
1680 ext_offset=str2double(get(handles.ext_offset,'String'));
1681 delay=str2double(get(hObject,'String'))+ext_offset;
1682 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTimeDelay',delay);
1683 
1684 % --- Executes during object creation, after setting all properties.
1685 function boo_ext_sept_p_CreateFcn(hObject, eventdata, handles)
1686 % hObject    handle to boo_ext_sept_p (see GCBO)
1687 % eventdata  reserved - to be defined in a future version of MATLAB
1688 % handles    empty - handles not created until after all CreateFcns called
1689 
1690 % Hint: edit controls usually have a white background on Windows.
1691 %       See ISPC and COMPUTER.
1692 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1693     set(hObject,'BackgroundColor','white');
1694 end
1695 
1696 
1697 
1698 function boo_ext_sept_a_Callback(hObject, eventdata, handles)
1699 % hObject    handle to boo_ext_sept_a (see GCBO)
1700 % eventdata  reserved - to be defined in a future version of MATLAB
1701 % handles    structure with handles and user data (see GUIDATA)
1702 
1703 % Hints: get(hObject,'String') returns contents of boo_ext_sept_a as text
1704 %        str2double(get(hObject,'String')) returns contents of boo_ext_sept_a as a double
1705 ext_offset=str2double(get(handles.ext_offset,'String'));
1706 delay=str2double(get(hObject,'String'))+ext_offset;
1707 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTimeDelay',delay);
1708 
1709 % --- Executes during object creation, after setting all properties.
1710 function boo_ext_sept_a_CreateFcn(hObject, eventdata, handles)
1711 % hObject    handle to boo_ext_sept_a (see GCBO)
1712 % eventdata  reserved - to be defined in a future version of MATLAB
1713 % handles    empty - handles not created until after all CreateFcns called
1714 
1715 % Hint: edit controls usually have a white background on Windows.
1716 %       See ISPC and COMPUTER.
1717 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1718     set(hObject,'BackgroundColor','white');
1719 end
1720 
1721 
1722 
1723 function boo_ext_kicker_Callback(hObject, eventdata, handles)
1724 % hObject    handle to boo_ext_kicker (see GCBO)
1725 % eventdata  reserved - to be defined in a future version of MATLAB
1726 % handles    structure with handles and user data (see GUIDATA)
1727 
1728 % Hints: get(hObject,'String') returns contents of boo_ext_kicker as text
1729 %        str2double(get(hObject,'String')) returns contents of boo_ext_kicker as a double
1730 ext_offset=str2double(get(handles.ext_offset,'String'));
1731 delay=str2double(get(hObject,'String'))+ext_offset;
1732 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTimeDelay',delay);
1733 
1734 
1735 % --- Executes during object creation, after setting all properties.
1736 function boo_ext_kicker_CreateFcn(hObject, eventdata, handles)
1737 % hObject    handle to boo_ext_kicker (see GCBO)
1738 % eventdata  reserved - to be defined in a future version of MATLAB
1739 % handles    empty - handles not created until after all CreateFcns called
1740 
1741 % Hint: edit controls usually have a white background on Windows.
1742 %       See ISPC and COMPUTER.
1743 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1744     set(hObject,'BackgroundColor','white');
1745 end
1746 
1747 
1748 
1749 function ans_inj_sept_p_Callback(hObject, eventdata, handles)
1750 % hObject    handle to ans_inj_sept_p (see GCBO)
1751 % eventdata  reserved - to be defined in a future version of MATLAB
1752 % handles    structure with handles and user data (see GUIDATA)
1753 
1754 % Hints: get(hObject,'String') returns contents of ans_inj_sept_p as text
1755 %        str2double(get(hObject,'String')) returns contents of ans_inj_sept_p as a double
1756 
1757 ext_offset=str2double(get(handles.ext_offset,'String'));
1758 delay=str2double(get(hObject,'String'))+ext_offset;
1759 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTimeDelay',delay);
1760 
1761 % --- Executes during object creation, after setting all properties.
1762 function ans_inj_sept_p_CreateFcn(hObject, eventdata, handles)
1763 % hObject    handle to ans_inj_sept_p (see GCBO)
1764 % eventdata  reserved - to be defined in a future version of MATLAB
1765 % handles    empty - handles not created until after all CreateFcns called
1766 
1767 % Hint: edit controls usually have a white background on Windows.
1768 %       See ISPC and COMPUTER.
1769 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1770     set(hObject,'BackgroundColor','white');
1771 end
1772 
1773 
1774 
1775 function ans_inj_sept_a_Callback(hObject, eventdata, handles)
1776 % hObject    handle to ans_inj_sept_a (see GCBO)
1777 % eventdata  reserved - to be defined in a future version of MATLAB
1778 % handles    structure with handles and user data (see GUIDATA)
1779 
1780 % Hints: get(hObject,'String') returns contents of ans_inj_sept_a as text
1781 %        str2double(get(hObject,'String')) returns contents of ans_inj_sept_a as a double
1782 
1783 ext_offset=str2double(get(handles.ext_offset,'String'));
1784 delay=str2double(get(hObject,'String'))+ext_offset;
1785 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTimeDelay',delay);
1786 
1787 % --- Executes during object creation, after setting all properties.
1788 function ans_inj_sept_a_CreateFcn(hObject, eventdata, handles)
1789 % hObject    handle to ans_inj_sept_a (see GCBO)
1790 % eventdata  reserved - to be defined in a future version of MATLAB
1791 % handles    empty - handles not created until after all CreateFcns called
1792 
1793 % Hint: edit controls usually have a white background on Windows.
1794 %       See ISPC and COMPUTER.
1795 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1796     set(hObject,'BackgroundColor','white');
1797 end
1798 
1799 
1800 
1801 function ans_inj_k1_Callback(hObject, eventdata, handles)
1802 % hObject    handle to ans_inj_k1 (see GCBO)
1803 % eventdata  reserved - to be defined in a future version of MATLAB
1804 % handles    structure with handles and user data (see GUIDATA)
1805 
1806 % Hints: get(hObject,'String') returns contents of ans_inj_k1 as text
1807 %        str2double(get(hObject,'String')) returns contents of ans_inj_k1 as a double
1808 
1809 ext_offset=str2double(get(handles.ext_offset,'String'));
1810 delay=str2double(get(hObject,'String'))+ext_offset;
1811 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTimeDelay',delay);
1812 
1813 
1814 
1815 % --- Executes during object creation, after setting all properties.
1816 function ans_inj_k1_CreateFcn(hObject, eventdata, handles)
1817 % hObject    handle to ans_inj_k1 (see GCBO)
1818 % eventdata  reserved - to be defined in a future version of MATLAB
1819 % handles    empty - handles not created until after all CreateFcns called
1820 
1821 % Hint: edit controls usually have a white background on Windows.
1822 %       See ISPC and COMPUTER.
1823 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1824     set(hObject,'BackgroundColor','white');
1825 end
1826 
1827 
1828 
1829 function ans_inj_k2_Callback(hObject, eventdata, handles)
1830 % hObject    handle to ans_inj_k2 (see GCBO)
1831 % eventdata  reserved - to be defined in a future version of MATLAB
1832 % handles    structure with handles and user data (see GUIDATA)
1833 
1834 % Hints: get(hObject,'String') returns contents of ans_inj_k2 as text
1835 %        str2double(get(hObject,'String')) returns contents of ans_inj_k2 as a double
1836 
1837 ext_offset=str2double(get(handles.ext_offset,'String'));
1838 delay=str2double(get(hObject,'String'))+ext_offset;
1839 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTimeDelay',delay);
1840 
1841 % --- Executes during object creation, after setting all properties.
1842 function ans_inj_k2_CreateFcn(hObject, eventdata, handles)
1843 % hObject    handle to ans_inj_k2 (see GCBO)
1844 % eventdata  reserved - to be defined in a future version of MATLAB
1845 % handles    empty - handles not created until after all CreateFcns called
1846 
1847 % Hint: edit controls usually have a white background on Windows.
1848 %       See ISPC and COMPUTER.
1849 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1850     set(hObject,'BackgroundColor','white');
1851 end
1852 
1853 
1854 
1855 function ans_inj_k3_Callback(hObject, eventdata, handles)
1856 % hObject    handle to ans_inj_k3 (see GCBO)
1857 % eventdata  reserved - to be defined in a future version of MATLAB
1858 % handles    structure with handles and user data (see GUIDATA)
1859 
1860 % Hints: get(hObject,'String') returns contents of ans_inj_k3 as text
1861 %        str2double(get(hObject,'String')) returns contents of ans_inj_k3 as a double
1862 
1863 ext_offset=str2double(get(handles.ext_offset,'String'));
1864 delay=str2double(get(hObject,'String'))+ext_offset;
1865 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTimeDelay',delay);
1866 
1867 % --- Executes during object creation, after setting all properties.
1868 function ans_inj_k3_CreateFcn(hObject, eventdata, handles)
1869 % hObject    handle to ans_inj_k3 (see GCBO)
1870 % eventdata  reserved - to be defined in a future version of MATLAB
1871 % handles    empty - handles not created until after all CreateFcns called
1872 
1873 % Hint: edit controls usually have a white background on Windows.
1874 %       See ISPC and COMPUTER.
1875 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1876     set(hObject,'BackgroundColor','white');
1877 end
1878 
1879 
1880 
1881 function ans_inj_k4_Callback(hObject, eventdata, handles)
1882 % hObject    handle to ans_inj_k4 (see GCBO)
1883 % eventdata  reserved - to be defined in a future version of MATLAB
1884 % handles    structure with handles and user data (see GUIDATA)
1885 
1886 % Hints: get(hObject,'String') returns contents of ans_inj_k4 as text
1887 %        str2double(get(hObject,'String')) returns contents of ans_inj_k4 as a double
1888 
1889 ext_offset=str2double(get(handles.ext_offset,'String'));
1890 delay=str2double(get(hObject,'String'))+ext_offset;
1891 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTimeDelay',delay);
1892 
1893 % --- Executes during object creation, after setting all properties.
1894 function ans_inj_k4_CreateFcn(hObject, eventdata, handles)
1895 % hObject    handle to ans_inj_k4 (see GCBO)
1896 % eventdata  reserved - to be defined in a future version of MATLAB
1897 % handles    empty - handles not created until after all CreateFcns called
1898 
1899 % Hint: edit controls usually have a white background on Windows.
1900 %       See ISPC and COMPUTER.
1901 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1902     set(hObject,'BackgroundColor','white');
1903 end
1904 
1905 
1906 
1907 function ans_dcct_Callback(hObject, eventdata, handles)
1908 % hObject    handle to ans_dcct (see GCBO)
1909 % eventdata  reserved - to be defined in a future version of MATLAB
1910 % handles    structure with handles and user data (see GUIDATA)
1911 
1912 % Hints: get(hObject,'String') returns contents of ans_dcct as text
1913 %        str2double(get(hObject,'String')) returns contents of ans_dcct as a double
1914 
1915 ext_offset=str2double(get(handles.ext_offset,'String'));
1916 delay=str2double(get(hObject,'String'))+ext_offset;
1917 tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'dcctTimeDelay',delay);
1918 
1919 
1920 % --- Executes during object creation, after setting all properties.
1921 function ans_dcct_CreateFcn(hObject, eventdata, handles)
1922 % hObject    handle to ans_dcct (see GCBO)
1923 % eventdata  reserved - to be defined in a future version of MATLAB
1924 % handles    empty - handles not created until after all CreateFcns called
1925 
1926 % Hint: edit controls usually have a white background on Windows.
1927 %       See ISPC and COMPUTER.
1928 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1929     set(hObject,'BackgroundColor','white');
1930 end
1931 
1932 
1933 
1934 function ans_bpm_Callback(hObject, eventdata, handles)
1935 % hObject    handle to ans_bpm (see GCBO)
1936 % eventdata  reserved - to be defined in a future version of MATLAB
1937 % handles    structure with handles and user data (see GUIDATA)
1938 
1939 % Hints: get(hObject,'String') returns contents of ans_bpm as text
1940 %        str2double(get(hObject,'String')) returns contents of ans_bpm as a double
1941 
1942 ext_offset=str2double(get(handles.ext_offset,'String'));
1943 delay=str2double(get(hObject,'String'))+ext_offset;
1944 tango_write_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
1945 tango_write_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1946 tango_write_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1947 tango_write_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1948 tango_write_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1949 tango_write_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1950 tango_write_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1951 tango_write_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1952 tango_write_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1953 tango_write_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1954 tango_write_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1955 tango_write_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1956 tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1957 tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1958 tango_write_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1959 tango_write_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1960 
1961 
1962 
1963 % --- Executes during object creation, after setting all properties.
1964 function ans_bpm_CreateFcn(hObject, eventdata, handles)
1965 % hObject    handle to ans_bpm (see GCBO)
1966 % eventdata  reserved - to be defined in a future version of MATLAB
1967 % handles    empty - handles not created until after all CreateFcns called
1968 
1969 % Hint: edit controls usually have a white background on Windows.
1970 %       See ISPC and COMPUTER.
1971 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1972     set(hObject,'BackgroundColor','white');
1973 end
1974 
1975 
1976 
1977 function central_ext_Callback(hObject, eventdata, handles)
1978 % hObject    handle to central_ext (see GCBO)
1979 % eventdata  reserved - to be defined in a future version of MATLAB
1980 % handles    structure with handles and user data (see GUIDATA)
1981 
1982 % Hints: get(hObject,'String') returns contents of central_ext as text
1983 %        str2double(get(hObject,'String')) returns contents of central_ext as a double
1984 %'ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue'
1985 
1986 delay=str2double(get(hObject,'String'));
1987 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue',delay);
1988 
1989 % --- Executes during object creation, after setting all properties.
1990 function central_ext_CreateFcn(hObject, eventdata, handles)
1991 % hObject    handle to central_ext (see GCBO)
1992 % eventdata  reserved - to be defined in a future version of MATLAB
1993 % handles    empty - handles not created until after all CreateFcns called
1994 
1995 % Hint: edit controls usually have a white background on Windows.
1996 %       See ISPC and COMPUTER.
1997 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1998     set(hObject,'BackgroundColor','white');
1999 end
2000 
2001 
2002 
2003 function central_soft1_Callback(hObject, eventdata, handles)
2004 % hObject    handle to central_soft1 (see GCBO)
2005 % eventdata  reserved - to be defined in a future version of MATLAB
2006 % handles    structure with handles and user data (see GUIDATA)
2007 
2008 % Hints: get(hObject,'String') returns contents of central_soft1 as text
2009 %        str2double(get(hObject,'String')) returns contents of central_soft1 as a double
2010 
2011 
2012 
2013 % --- Executes during object creation, after setting all properties.
2014 function central_soft1_CreateFcn(hObject, eventdata, handles)
2015 % hObject    handle to central_soft1 (see GCBO)
2016 % eventdata  reserved - to be defined in a future version of MATLAB
2017 % handles    empty - handles not created until after all CreateFcns called
2018 
2019 % Hint: edit controls usually have a white background on Windows.
2020 %       See ISPC and COMPUTER.
2021 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2022     set(hObject,'BackgroundColor','white');
2023 end
2024 
2025 
2026 % --- Executes on button press in radiobutton6.
2027 function radiobutton6_Callback(hObject, eventdata, handles)
2028 % hObject    handle to radiobutton6 (see GCBO)
2029 % eventdata  reserved - to be defined in a future version of MATLAB
2030 % handles    structure with handles and user data (see GUIDATA)
2031 
2032 % Hint: get(hObject,'Value') returns toggle state of radiobutton6
2033 
2034 
2035 % --- Executes on button press in pushbutton8.
2036 function pushbutton8_Callback(hObject, eventdata, handles)
2037 % hObject    handle to pushbutton8 (see GCBO)
2038 % eventdata  reserved - to be defined in a future version of MATLAB
2039 % handles    structure with handles and user data (see GUIDATA)
2040 
2041 
2042 % --- Executes on button press in pushbutton9.
2043 function pushbutton9_Callback(hObject, eventdata, handles)
2044 % hObject    handle to pushbutton9 (see GCBO)
2045 % eventdata  reserved - to be defined in a future version of MATLAB
2046 % handles    structure with handles and user data (see GUIDATA)
2047 
2048 
2049 % --- Executes on button press in button_extmoins.
2050 function button_extmoins_Callback(hObject, eventdata, handles)
2051 % hObject    handle to button_extmoins (see GCBO)
2052 % eventdata  reserved - to be defined in a future version of MATLAB
2053 % handles    structure with handles and user data (see GUIDATA)
2054 
2055 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue');
2056 step=temp.value(1)-52*0.52243;
2057 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue',step);
2058 temp=tango_read_attribute2('ANS/SY/CENTRAL','ExtractionOffsetTimeValue');
2059 set(handles.central_ext,'String',num2str(temp.value(1)));
2060 
2061 % --- Executes on button press in button_extplus.
2062 function button_extplus_Callback(hObject, eventdata, handles)
2063 % hObject    handle to button_extplus (see GCBO)
2064 % eventdata  reserved - to be defined in a future version of MATLAB
2065 % handles    structure with handles and user data (see GUIDATA)
2066 
2067 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue');
2068 step=temp.value(1)+52*0.52243;
2069 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue',step);
2070 temp=tango_read_attribute2('ANS/SY/CENTRAL','ExtractionOffsetTimeValue');
2071 set(handles.central_ext,'String',num2str(temp.value(1)));
2072 
2073 function sdc2_Callback(hObject, eventdata, handles)
2074 % hObject    handle to sdc2 (see GCBO)
2075 % eventdata  reserved - to be defined in a future version of MATLAB
2076 % handles    structure with handles and user data (see GUIDATA)
2077 
2078 % Hints: get(hObject,'String') returns contents of sdc2 as text
2079 %        str2double(get(hObject,'String')) returns contents of sdc2 as a double
2080 ext_offset=str2double(get(handles.ext_offset,'String'));
2081 delay=str2double(get(hObject,'String'))+ext_offset;
2082 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTimeDelay',delay);
2083 
2084 % --- Executes during object creation, after setting all properties.
2085 function sdc2_CreateFcn(hObject, eventdata, handles)
2086 % hObject    handle to sdc2 (see GCBO)
2087 % eventdata  reserved - to be defined in a future version of MATLAB
2088 % handles    empty - handles not created until after all CreateFcns called
2089 
2090 % Hint: edit controls usually have a white background on Windows.
2091 %       See ISPC and COMPUTER.
2092 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2093     set(hObject,'BackgroundColor','white');
2094 end
2095 
2096 
2097 
2098 function lt2_emittance_Callback(hObject, eventdata, handles)
2099 % hObject    handle to lt2_emittance (see GCBO)
2100 % eventdata  reserved - to be defined in a future version of MATLAB
2101 % handles    structure with handles and user data (see GUIDATA)
2102 
2103 % Hints: get(hObject,'String') returns contents of lt2_emittance as text
2104 %        str2double(get(hObject,'String')) returns contents of lt2_emittance as a double
2105 ext_offset=str2double(get(handles.ext_offset,'String'));
2106 delay=str2double(get(hObject,'String'))+ext_offset;
2107 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTimeDelay',delay);
2108 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'emittanceTimeDelay',delay);
2109 
2110 
2111 % --- Executes during object creation, after setting all properties.
2112 function lt2_emittance_CreateFcn(hObject, eventdata, handles)
2113 % hObject    handle to lt2_emittance (see GCBO)
2114 % eventdata  reserved - to be defined in a future version of MATLAB
2115 % handles    empty - handles not created until after all CreateFcns called
2116 
2117 % Hint: edit controls usually have a white background on Windows.
2118 %       See ISPC and COMPUTER.
2119 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2120     set(hObject,'BackgroundColor','white');
2121 end
2122 
2123 
2124 
2125 function lt2_bpm_Callback(hObject, eventdata, handles)
2126 % hObject    handle to lt2_bpm (see GCBO)
2127 % eventdata  reserved - to be defined in a future version of MATLAB
2128 % handles    structure with handles and user data (see GUIDATA)
2129 
2130 % Hints: get(hObject,'String') returns contents of lt2_bpm as text
2131 %        str2double(get(hObject,'String')) returns contents of lt2_bpm as a double
2132 ext_offset=str2double(get(handles.ext_offset,'String'));
2133 delay=str2double(get(hObject,'String'))+ext_offset;
2134 tango_write_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
2135 
2136 % --- Executes during object creation, after setting all properties.
2137 function lt2_bpm_CreateFcn(hObject, eventdata, handles)
2138 % hObject    handle to lt2_bpm (see GCBO)
2139 % eventdata  reserved - to be defined in a future version of MATLAB
2140 % handles    empty - handles not created until after all CreateFcns called
2141 
2142 % Hint: edit controls usually have a white background on Windows.
2143 %       See ISPC and COMPUTER.
2144 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2145     set(hObject,'BackgroundColor','white');
2146 end
2147 
2148 
2149 
2150 function lt2_osc_Callback(hObject, eventdata, handles)
2151 % hObject    handle to lt2_osc (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 % Hints: get(hObject,'String') returns contents of lt2_osc as text
2156 %        str2double(get(hObject,'String')) returns contents of lt2_osc as a double
2157 ext_offset=str2double(get(handles.ext_offset,'String'));
2158 delay=str2double(get(hObject,'String'))+ext_offset;
2159 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTimeDelay',delay);
2160 
2161 % --- Executes during object creation, after setting all properties.
2162 function lt2_osc_CreateFcn(hObject, eventdata, handles)
2163 % hObject    handle to lt2_osc (see GCBO)
2164 % eventdata  reserved - to be defined in a future version of MATLAB
2165 % handles    empty - handles not created until after all CreateFcns called
2166 
2167 % Hint: edit controls usually have a white background on Windows.
2168 %       See ISPC and COMPUTER.
2169 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2170     set(hObject,'BackgroundColor','white');
2171 end
2172 
2173 
2174 
2175 function lin_modulateur_Callback(hObject, eventdata, handles)
2176 % hObject    handle to lin_modulateur (see GCBO)
2177 % eventdata  reserved - to be defined in a future version of MATLAB
2178 % handles    structure with handles and user data (see GUIDATA)
2179 
2180 % Hints: get(hObject,'String') returns contents of lin_modulateur as text
2181 %        str2double(get(hObject,'String')) returns contents of lin_modulateur as a double
2182 inj_offset=str2double(get(handles.inj_offset,'String'));
2183 delay=str2double(get(hObject,'String'))+inj_offset;
2184 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
2185 
2186 % --- Executes during object creation, after setting all properties.
2187 function lin_modulateur_CreateFcn(hObject, eventdata, handles)
2188 % hObject    handle to lin_modulateur (see GCBO)
2189 % eventdata  reserved - to be defined in a future version of MATLAB
2190 % handles    empty - handles not created until after all CreateFcns called
2191 
2192 % Hint: edit controls usually have a white background on Windows.
2193 %       See ISPC and COMPUTER.
2194 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2195     set(hObject,'BackgroundColor','white');
2196 end
2197 
2198 
2199 
2200 function inj_offset_Callback(hObject, eventdata, handles)
2201 % hObject    handle to inj_offset (see GCBO)
2202 % eventdata  reserved - to be defined in a future version of MATLAB
2203 % handles    structure with handles and user data (see GUIDATA)
2204 
2205 % Hints: get(hObject,'String') returns contents of inj_offset as text
2206 %        str2double(get(hObject,'String')) returns contents of inj_offset as a double
2207 
2208 inj_offset=str2double(get(hObject,'String'));
2209 ext_offset=str2double(get(handles.ext_offset,'String'));
2210 lin_fin   =str2double(get(handles.lin_canon_spm_fin,'String'));
2211 save('synchro_offset_lin', 'inj_offset' , 'ext_offset', 'lin_fin')
2212 
2213 %LIN
2214 delay=str2double(get(handles.lin_canon_lpm,'String'))+inj_offset;
2215 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmTimeDelay',delay);
2216 
2217 delay=str2double(get(handles.lin_modulateur,'String'))+inj_offset;
2218 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
2219 
2220 delay=str2double(get(handles.sdc1,'String'))+inj_offset;
2221 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'oscTimeDelay',delay);
2222 
2223 
2224 % LT1
2225 delay=str2double(get(handles.lt1_MC2,'String'))+inj_offset;
2226 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2TimeDelay',delay);
2227 
2228 delay=str2double(get(handles.lt1_MC1,'String'))+inj_offset;
2229 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1TimeDelay',delay);
2230 
2231 delay=str2double(get(handles.lt1_emittance,'String'))+inj_offset;
2232 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceTimeDelay',delay);
2233 
2234 delay=str2double(get(handles.lt1_osc,'String'))+inj_offset;
2235 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'oscTimeDelay',delay);
2236 
2237 
2238 % BOO
2239 delay=str2double(get(handles.boo_inj_septum,'String'))+inj_offset;
2240 tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigTimeDelay',delay);
2241 
2242 delay=str2double(get(handles.boo_inj_kicker,'String'))+inj_offset;
2243 tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigTimeDelay',delay);
2244 
2245 delay=str2double(get(handles.boo_bpm,'String'))+inj_offset;
2246 tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigTimeDelay',delay);
2247 tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-btd.trigTimeDelay',delay);
2248 tango_write_attribute2('BOO/SY/LOCAL.DG.2', 'bpm-btb.trigTimeDelay',delay);
2249 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-btc.trigTimeDelay',delay);
2250 
2251 
2252 delay=str2double(get(handles.boo_nod,'String'))+inj_offset;
2253 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigTimeDelay',delay);
2254 
2255 delay=str2double(get(handles.boo_dcct,'String'))+inj_offset;
2256 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booTimeDelay',delay);
2257 
2258 
2259 
2260 % --- Executes during object creation, after setting all properties.
2261 function inj_offset_CreateFcn(hObject, eventdata, handles)
2262 % hObject    handle to inj_offset (see GCBO)
2263 % eventdata  reserved - to be defined in a future version of MATLAB
2264 % handles    empty - handles not created until after all CreateFcns called
2265 
2266 % Hint: edit controls usually have a white background on Windows.
2267 %       See ISPC and COMPUTER.
2268 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2269     set(hObject,'BackgroundColor','white');
2270 end
2271 
2272 
2273 
2274 function ext_offset_Callback(hObject, eventdata, handles)
2275 % hObject    handle to ext_offset (see GCBO)
2276 % eventdata  reserved - to be defined in a future version of MATLAB
2277 % handles    structure with handles and user data (see GUIDATA)
2278 
2279 % Hints: get(hObject,'String') returns contents of ext_offset as text
2280 %        str2double(get(hObject,'String')) returns contents of ext_offset as a double
2281 
2282 ext_offset=str2double(get(hObject,'String'));
2283 inj_offset=str2double(get(handles.inj_offset,'String'));
2284 lin_fin   =str2double(get(handles.lin_canon_spm_fin,'String'));
2285 save('synchro_offset_lin', 'inj_offset' , 'ext_offset', 'lin_fin')
2286 
2287 
2288 %BOO
2289 delay=str2double(get(handles.boo_ext_dof,'String'))+ext_offset;
2290 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTimeDelay',delay);
2291 
2292 delay=str2double(get(handles.boo_ext_sept_p,'String'))+ext_offset;
2293 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTimeDelay',delay);
2294 
2295 delay=str2double(get(handles.boo_ext_sept_a,'String'))+ext_offset;
2296 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTimeDelay',delay);
2297 
2298 delay=str2double(get(handles.boo_ext_kicker,'String'))+ext_offset;
2299 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTimeDelay',delay);
2300 
2301 delay=str2double(get(handles.sdc2,'String'))+ext_offset;
2302 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTimeDelay',delay);
2303 
2304 %LT2
2305 delay=str2double(get(handles.lt2_bpm,'String'))+ext_offset;
2306 tango_write_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
2307 
2308 delay=str2double(get(handles.lt2_osc,'String'))+ext_offset;
2309 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTimeDelay',delay);
2310 
2311 delay=str2double(get(handles.lt2_emittance,'String'))+ext_offset;
2312 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTimeDelay',delay);
2313 
2314 %ANS
2315 
2316 delay=str2double(get(handles.ans_inj_sept_a,'String'))+ext_offset;
2317 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTimeDelay',delay);
2318 
2319 delay=str2double(get(handles.ans_inj_sept_p,'String'))+ext_offset;
2320 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTimeDelay',delay);
2321 
2322 delay=str2double(get(handles.ans_inj_k1,'String'))+ext_offset;
2323 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTimeDelay',delay);
2324 
2325 delay=str2double(get(handles.ans_inj_k2,'String'))+ext_offset;
2326 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTimeDelay',delay);
2327 
2328 delay=str2double(get(handles.ans_inj_k3,'String'))+ext_offset;
2329 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTimeDelay',delay);
2330 
2331 delay=str2double(get(handles.ans_inj_k4,'String'))+ext_offset;
2332 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTimeDelay',delay);
2333 
2334 
2335 
2336 % --- Executes during object creation, after setting all properties.
2337 function ext_offset_CreateFcn(hObject, eventdata, handles)
2338 % hObject    handle to ext_offset (see GCBO)
2339 % eventdata  reserved - to be defined in a future version of MATLAB
2340 % handles    empty - handles not created until after all CreateFcns called
2341 
2342 % Hint: edit controls usually have a white background on Windows.
2343 %       See ISPC and COMPUTER.
2344 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2345     set(hObject,'BackgroundColor','white');
2346 end
2347 
2348 
2349 % --- Executes on button press in button_acquisition_address.
2350 function button_acquisition_address_Callback(hObject, eventdata, handles)
2351 % hObject    handle to button_acquisition_address (see GCBO)
2352 % eventdata  reserved - to be defined in a future version of MATLAB
2353 % handles    structure with handles and user data (see GUIDATA)
2354 
2355 set(handles.inj_offset,'Enable','off');
2356 set(handles.sdc1,'Enable','off');
2357 set(handles.lin_canon_lpm,'Enable','off');
2358 set(handles.lin_canon_spm,'Enable','off');
2359 set(handles.lin_canon_spm_fin,'Enable','off');
2360 set(handles.boo_bpm,'Enable','off');
2361 set(handles.lt1_emittance,'Enable','off');
2362 set(handles.lt1_MC1,'Enable','off');
2363 set(handles.lt1_MC2,'Enable','off');
2364 set(handles.lt1_osc,'Enable','off');
2365 set(handles.boo_dcct,'Enable','off');
2366 set(handles.boo_nod,'Enable','off');
2367 set(handles.boo_inj_septum,'Enable','off');
2368 set(handles.boo_inj_kicker,'Enable','off');
2369 set(handles.boo_alim_dipole,'Enable','off');
2370 set(handles.boo_alim_qf,'Enable','off');
2371 set(handles.boo_alim_qd,'Enable','off');
2372 set(handles.boo_alim_sf,'Enable','off');
2373 set(handles.boo_alim_sd,'Enable','off');
2374 set(handles.boo_rf,'Enable','off');
2375 set(handles.lin_modulateur,'Enable','off');
2376 set(handles.ext_offset,'Enable','off');
2377 set(handles.boo_ext_dof,'Enable','off');
2378 set(handles.boo_ext_sept_p,'Enable','off');
2379 set(handles.boo_ext_sept_a,'Enable','off');
2380 set(handles.boo_ext_kicker,'Enable','off');
2381 set(handles.sdc2,'Enable','off');
2382 set(handles.lt2_emittance,'Enable','off');
2383 set(handles.lt2_osc,'Enable','off');
2384 set(handles.lt2_bpm,'Enable','off');
2385 set(handles.ans_inj_k1,'Enable','off');
2386 set(handles.ans_inj_k2,'Enable','off');
2387 set(handles.ans_inj_k3,'Enable','off');
2388 set(handles.ans_inj_k4,'Enable','off');
2389 set(handles.ans_inj_sept_p,'Enable','off');
2390 set(handles.ans_inj_sept_a,'Enable','off');
2391 set(handles.ans_bpm,'Enable','off');
2392 set(handles.ans_dcct,'Enable','off');
2393 set(handles.ans_bpm_c01,'Enable','off');
2394 set(handles.ans_bpm_c02,'Enable','off');
2395 set(handles.ans_bpm_c03,'Enable','off');
2396 set(handles.ans_bpm_c04,'Enable','off');
2397 set(handles.ans_bpm_c05,'Enable','off');
2398 set(handles.ans_bpm_c06,'Enable','off');
2399 set(handles.ans_bpm_c07,'Enable','off');
2400 set(handles.ans_bpm_c08,'Enable','off');
2401 set(handles.ans_bpm_c09,'Enable','off');
2402 set(handles.ans_bpm_c10,'Enable','off');
2403 set(handles.ans_bpm_c11,'Enable','off');
2404 set(handles.ans_bpm_c12,'Enable','off');
2405 set(handles.ans_bpm_c13,'Enable','off');
2406 set(handles.ans_bpm_c14,'Enable','off');
2407 set(handles.ans_bpm_c15,'Enable','off');
2408 set(handles.ans_bpm_c16,'Enable','off');
2409 
2410 
2411 n=1;
2412 
2413 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay');
2414 set(handles.central_pc,'String',num2str(temp.value(n)));
2415 
2416 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
2417 set(handles.central_inj,'String',num2str(temp.value(n)));
2418 
2419 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
2420 set(handles.central_soft,'String',num2str(temp.value(n)));
2421 
2422 temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue');
2423 set(handles.central_ext,'String',num2str(temp.value(n)));
2424 
2425 
2426 temp=tango_read_attribute2('ANS/SY/LOCAL.SDC.1', 'oscEvent');
2427 set(handles.sdc1,'String',num2str(temp.value(n)));
2428 
2429 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
2430 set(handles.lin_canon_lpm,'String',num2str(temp.value(n)));
2431 
2432 temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent');
2433 set(handles.lin_canon_spm,'String',num2str(temp.value(n)));
2434 set(handles.lin_canon_spm_fin,'String','Off Set table');
2435 
2436 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigEvent');
2437 set(handles.boo_bpm,'String',num2str(temp.value(n)));
2438 
2439 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceEvent');
2440 set(handles.lt1_emittance,'String',num2str(temp.value(n)));
2441 
2442 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1Event');
2443 set(handles.lt1_MC1,'String',num2str(temp.value(n)));
2444 
2445 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2Event');
2446 set(handles.lt1_MC2,'String',num2str(temp.value(n)));
2447 
2448 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'oscEvent');
2449 set(handles.lt1_osc,'String',num2str(temp.value(n)));
2450 
2451 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booEvent');
2452 set(handles.boo_dcct,'String',num2str(temp.value(n)));
2453 
2454 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigEvent');
2455 set(handles.boo_nod,'String',num2str(temp.value(n)));
2456 
2457 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigEvent');
2458 set(handles.boo_inj_septum,'String',num2str(temp.value(n)));
2459 
2460 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
2461 set(handles.boo_inj_kicker,'String',num2str(temp.value(n)));
2462 
2463 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'dpEvent');
2464 set(handles.boo_alim_dipole,'String',num2str(temp.value(n)));
2465 
2466 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfEvent');
2467 set(handles.boo_alim_qf,'String',num2str(temp.value(n)));
2468 
2469 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdEvent');
2470 set(handles.boo_alim_qd,'String',num2str(temp.value(n)));
2471 
2472 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'sfEvent');
2473 set(handles.boo_alim_sf,'String',num2str(temp.value(n)));
2474 
2475 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'sdEvent');
2476 set(handles.boo_alim_sd,'String',num2str(temp.value(n)));
2477 
2478 temp=tango_read_attribute2('BOO/SY/LOCAL.RF.1', 'rfEvent');
2479 set(handles.boo_rf,'String',num2str(temp.value(n)));
2480 
2481 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareEvent');
2482 set(handles.lin_modulateur,'String',num2str(temp.value(n)));
2483 
2484 
2485 
2486 
2487 
2488 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigEvent');
2489 set(handles.boo_ext_dof,'String',num2str(temp.value(n)));
2490 
2491 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigEvent');
2492 set(handles.boo_ext_sept_p,'String',num2str(temp.value(n)));
2493 
2494 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigEvent');
2495 set(handles.boo_ext_sept_a,'String',num2str(temp.value(n)));
2496 
2497 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigEvent');
2498 set(handles.boo_ext_kicker,'String',num2str(temp.value(n)));
2499 
2500 
2501 
2502 temp=tango_read_attribute2('ANS/SY/LOCAL.SDC.1', 'spareEvent');
2503 set(handles.sdc2,'String',num2str(temp.value(n)));
2504 
2505 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvEvent');
2506 set(handles.lt2_emittance,'String',num2str(temp.value(n)));
2507 
2508 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctEvent');
2509 set(handles.lt2_osc,'String',num2str(temp.value(n)));
2510 
2511 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigEvent');
2512 set(handles.lt2_bpm,'String',num2str(temp.value(n)));
2513 
2514 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigEvent');
2515 set(handles.ans_inj_k1,'String',num2str(temp.value(n)));
2516 
2517 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigEvent');
2518 set(handles.ans_inj_k2,'String',num2str(temp.value(n)));
2519 
2520 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigEvent');
2521 set(handles.ans_inj_k3,'String',num2str(temp.value(n)));
2522 
2523 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigEvent');
2524 set(handles.ans_inj_k4,'String',num2str(temp.value(n)));
2525 
2526 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigEvent');
2527 set(handles.ans_inj_sept_p,'String',num2str(temp.value(n)));
2528 
2529 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigEvent');
2530 set(handles.ans_inj_sept_a,'String',num2str(temp.value(n)));
2531 
2532 temp=tango_read_attribute2('ANS-C13/SY/LOCAL.DG.1', 'dcctEvent');
2533 set(handles.ans_dcct,'String',num2str(temp.value(n)));
2534 
2535 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigEvent');
2536 set(handles.ans_bpm,'String',num2str(temp.value(n)));
2537 set(handles.ans_bpm_c01,'String',num2str(temp.value(n)));
2538 
2539 temp=tango_read_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigEvent');
2540 set(handles.ans_bpm_c02,'String',num2str(temp.value(n)));
2541 temp=tango_read_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigEvent');
2542 set(handles.ans_bpm_c03,'String',num2str(temp.value(n)));
2543 temp=tango_read_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigEvent');
2544 set(handles.ans_bpm_c04,'String',num2str(temp.value(n)));
2545 temp=tango_read_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigEvent');
2546 set(handles.ans_bpm_c05,'String',num2str(temp.value(n)));
2547 temp=tango_read_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigEvent');
2548 set(handles.ans_bpm_c06,'String',num2str(temp.value(n)));
2549 temp=tango_read_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigEvent');
2550 set(handles.ans_bpm_c07,'String',num2str(temp.value(n)));
2551 temp=tango_read_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigEvent');
2552 set(handles.ans_bpm_c08,'String',num2str(temp.value(n)));
2553 temp=tango_read_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigEvent');
2554 set(handles.ans_bpm_c09,'String',num2str(temp.value(n)));
2555 temp=tango_read_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigEvent');
2556 set(handles.ans_bpm_c10,'String',num2str(temp.value(n)));
2557 temp=tango_read_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigEvent');
2558 set(handles.ans_bpm_c11,'String',num2str(temp.value(n)));
2559 temp=tango_read_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigEvent');
2560 set(handles.ans_bpm_c12,'String',num2str(temp.value(n)));
2561 temp=tango_read_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigEvent');
2562 set(handles.ans_bpm_c13,'String',num2str(temp.value(n)));
2563 temp=tango_read_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigEvent');
2564 set(handles.ans_bpm_c14,'String',num2str(temp.value(n)));
2565 temp=tango_read_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigEvent');
2566 set(handles.ans_bpm_c15,'String',num2str(temp.value(n)));
2567 temp=tango_read_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigEvent');
2568 set(handles.ans_bpm_c16,'String',num2str(temp.value(n)));
2569 
2570 
2571 
2572 % --- Executes on button press in button_offinj_moins.
2573 function button_offinj_moins_Callback(hObject, eventdata, handles)
2574 % hObject    handle to button_offinj_moins (see GCBO)
2575 % eventdata  reserved - to be defined in a future version of MATLAB
2576 % handles    structure with handles and user data (see GUIDATA)
2577 
2578 temp=str2double(get(handles.inj_offset,'String'));
2579 step=temp-52*0.52243;
2580 set(handles.inj_offset,'String',step);
2581 inj_offset_Callback(handles.inj_offset, eventdata, handles);
2582 
2583 % --- Executes on button press in button_offinj_plus.
2584 function button_offinj_plus_Callback(hObject, eventdata, handles)
2585 % hObject    handle to button_offinj_plus (see GCBO)
2586 % eventdata  reserved - to be defined in a future version of MATLAB
2587 % handles    structure with handles and user data (see GUIDATA)
2588 
2589 temp=str2double(get(handles.inj_offset,'String'));
2590 step=temp+52*0.52243;
2591 set(handles.inj_offset,'String',step);
2592 inj_offset_Callback(handles.inj_offset, eventdata, handles);
2593 
2594 % --- Executes on button press in button_offext_moins.
2595 function button_offext_moins_Callback(hObject, eventdata, handles)
2596 % hObject    handle to button_offext_moins (see GCBO)
2597 % eventdata  reserved - to be defined in a future version of MATLAB
2598 % handles    structure with handles and user data (see GUIDATA)
2599 
2600 temp=str2double(get(handles.ext_offset,'String'));
2601 step=temp-52*0.52243;
2602 set(handles.ext_offset,'String',step);
2603 ext_offset_Callback(handles.ext_offset, eventdata, handles);
2604 
2605 % --- Executes on button press in button_offext_plus.
2606 function button_offext_plus_Callback(hObject, eventdata, handles)
2607 % hObject    handle to button_offext_plus (see GCBO)
2608 % eventdata  reserved - to be defined in a future version of MATLAB
2609 % handles    structure with handles and user data (see GUIDATA)
2610 
2611 temp=str2double(get(handles.ext_offset,'String'));
2612 step=temp+52*0.52243;
2613 set(handles.ext_offset,'String',step);
2614 ext_offset_Callback(handles.ext_offset, eventdata, handles);
2615 
2616 
2617 % --- Executes on button press in button_bpm.
2618 function button_bpm_Callback(hObject, eventdata, handles)
2619 % hObject    handle to button_bpm (see GCBO)
2620 % eventdata  reserved - to be defined in a future version of MATLAB
2621 % handles    structure with handles and user data (see GUIDATA)
2622 
2623 % Hint: get(hObject,'Value') returns toggle state of button_bpm
2624 
2625 bpm=get(hObject,'Value');
2626 
2627 if (bpm==0)
2628    set(handles.panel_bpm,'Visible','off');
2629 elseif (bpm==1)
2630     set(handles.panel_bpm,'Visible','on');
2631 end
2632 
2633 
2634 
2635 function ans_bpm_c01_Callback(hObject, eventdata, handles)
2636 % hObject    handle to ans_bpm_c01 (see GCBO)
2637 % eventdata  reserved - to be defined in a future version of MATLAB
2638 % handles    structure with handles and user data (see GUIDATA)
2639 
2640 % Hints: get(hObject,'String') returns contents of ans_bpm_c01 as text
2641 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c01 as a double
2642 
2643 ext_offset=str2double(get(handles.ext_offset,'String'));
2644 delay=str2double(get(hObject,'String'))+ext_offset;
2645 tango_write_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
2646 
2647 % --- Executes during object creation, after setting all properties.
2648 function ans_bpm_c01_CreateFcn(hObject, eventdata, handles)
2649 % hObject    handle to ans_bpm_c01 (see GCBO)
2650 % eventdata  reserved - to be defined in a future version of MATLAB
2651 % handles    empty - handles not created until after all CreateFcns called
2652 
2653 % Hint: edit controls usually have a white background on Windows.
2654 %       See ISPC and COMPUTER.
2655 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2656     set(hObject,'BackgroundColor','white');
2657 end
2658 
2659 
2660 function ans_bpm_c02_Callback(hObject, eventdata, handles)
2661 % hObject    handle to ans_bpm_c02 (see GCBO)
2662 % eventdata  reserved - to be defined in a future version of MATLAB
2663 % handles    structure with handles and user data (see GUIDATA)
2664 
2665 % Hints: get(hObject,'String') returns contents of ans_bpm_c02 as text
2666 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c02 as a double
2667 ext_offset=str2double(get(handles.ext_offset,'String'));
2668 delay=str2double(get(hObject,'String'))+ext_offset;
2669 tango_write_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2670 
2671 
2672 % --- Executes during object creation, after setting all properties.
2673 function ans_bpm_c02_CreateFcn(hObject, eventdata, handles)
2674 % hObject    handle to ans_bpm_c02 (see GCBO)
2675 % eventdata  reserved - to be defined in a future version of MATLAB
2676 % handles    empty - handles not created until after all CreateFcns called
2677 
2678 % Hint: edit controls usually have a white background on Windows.
2679 %       See ISPC and COMPUTER.
2680 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2681     set(hObject,'BackgroundColor','white');
2682 end
2683 
2684 
2685 
2686 function ans_bpm_c03_Callback(hObject, eventdata, handles)
2687 % hObject    handle to ans_bpm_c03 (see GCBO)
2688 % eventdata  reserved - to be defined in a future version of MATLAB
2689 % handles    structure with handles and user data (see GUIDATA)
2690 
2691 % Hints: get(hObject,'String') returns contents of ans_bpm_c03 as text
2692 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c03 as a double
2693 ext_offset=str2double(get(handles.ext_offset,'String'));
2694 delay=str2double(get(hObject,'String'))+ext_offset;
2695 tango_write_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2696 
2697 
2698 % --- Executes during object creation, after setting all properties.
2699 function ans_bpm_c03_CreateFcn(hObject, eventdata, handles)
2700 % hObject    handle to ans_bpm_c03 (see GCBO)
2701 % eventdata  reserved - to be defined in a future version of MATLAB
2702 % handles    empty - handles not created until after all CreateFcns called
2703 
2704 % Hint: edit controls usually have a white background on Windows.
2705 %       See ISPC and COMPUTER.
2706 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2707     set(hObject,'BackgroundColor','white');
2708 end
2709 
2710 
2711 
2712 function ans_bpm_c04_Callback(hObject, eventdata, handles)
2713 % hObject    handle to ans_bpm_c04 (see GCBO)
2714 % eventdata  reserved - to be defined in a future version of MATLAB
2715 % handles    structure with handles and user data (see GUIDATA)
2716 
2717 % Hints: get(hObject,'String') returns contents of ans_bpm_c04 as text
2718 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c04 as a double
2719 ext_offset=str2double(get(handles.ext_offset,'String'));
2720 delay=str2double(get(hObject,'String'))+ext_offset;
2721 tango_write_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2722 
2723 
2724 % --- Executes during object creation, after setting all properties.
2725 function ans_bpm_c04_CreateFcn(hObject, eventdata, handles)
2726 % hObject    handle to ans_bpm_c04 (see GCBO)
2727 % eventdata  reserved - to be defined in a future version of MATLAB
2728 % handles    empty - handles not created until after all CreateFcns called
2729 
2730 % Hint: edit controls usually have a white background on Windows.
2731 %       See ISPC and COMPUTER.
2732 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2733     set(hObject,'BackgroundColor','white');
2734 end
2735 
2736 
2737 
2738 function ans_bpm_c05_Callback(hObject, eventdata, handles)
2739 % hObject    handle to ans_bpm_c05 (see GCBO)
2740 % eventdata  reserved - to be defined in a future version of MATLAB
2741 % handles    structure with handles and user data (see GUIDATA)
2742 
2743 % Hints: get(hObject,'String') returns contents of ans_bpm_c05 as text
2744 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c05 as a double
2745 ext_offset=str2double(get(handles.ext_offset,'String'));
2746 delay=str2double(get(hObject,'String'))+ext_offset;
2747 tango_write_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2748 
2749 
2750 % --- Executes during object creation, after setting all properties.
2751 function ans_bpm_c05_CreateFcn(hObject, eventdata, handles)
2752 % hObject    handle to ans_bpm_c05 (see GCBO)
2753 % eventdata  reserved - to be defined in a future version of MATLAB
2754 % handles    empty - handles not created until after all CreateFcns called
2755 
2756 % Hint: edit controls usually have a white background on Windows.
2757 %       See ISPC and COMPUTER.
2758 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2759     set(hObject,'BackgroundColor','white');
2760 end
2761 
2762 
2763 
2764 function ans_bpm_c06_Callback(hObject, eventdata, handles)
2765 % hObject    handle to ans_bpm_c06 (see GCBO)
2766 % eventdata  reserved - to be defined in a future version of MATLAB
2767 % handles    structure with handles and user data (see GUIDATA)
2768 
2769 % Hints: get(hObject,'String') returns contents of ans_bpm_c06 as text
2770 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c06 as a double
2771 ext_offset=str2double(get(handles.ext_offset,'String'));
2772 delay=str2double(get(hObject,'String'))+ext_offset;
2773 tango_write_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2774 
2775 
2776 % --- Executes during object creation, after setting all properties.
2777 function ans_bpm_c06_CreateFcn(hObject, eventdata, handles)
2778 % hObject    handle to ans_bpm_c06 (see GCBO)
2779 % eventdata  reserved - to be defined in a future version of MATLAB
2780 % handles    empty - handles not created until after all CreateFcns called
2781 
2782 % Hint: edit controls usually have a white background on Windows.
2783 %       See ISPC and COMPUTER.
2784 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2785     set(hObject,'BackgroundColor','white');
2786 end
2787 
2788 
2789 
2790 function ans_bpm_c07_Callback(hObject, eventdata, handles)
2791 % hObject    handle to ans_bpm_c07 (see GCBO)
2792 % eventdata  reserved - to be defined in a future version of MATLAB
2793 % handles    structure with handles and user data (see GUIDATA)
2794 
2795 % Hints: get(hObject,'String') returns contents of ans_bpm_c07 as text
2796 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c07 as a double
2797 ext_offset=str2double(get(handles.ext_offset,'String'));
2798 delay=str2double(get(hObject,'String'))+ext_offset;
2799 tango_write_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2800 
2801 
2802 % --- Executes during object creation, after setting all properties.
2803 function ans_bpm_c07_CreateFcn(hObject, eventdata, handles)
2804 % hObject    handle to ans_bpm_c07 (see GCBO)
2805 % eventdata  reserved - to be defined in a future version of MATLAB
2806 % handles    empty - handles not created until after all CreateFcns called
2807 
2808 % Hint: edit controls usually have a white background on Windows.
2809 %       See ISPC and COMPUTER.
2810 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2811     set(hObject,'BackgroundColor','white');
2812 end
2813 
2814 
2815 
2816 function ans_bpm_c08_Callback(hObject, eventdata, handles)
2817 % hObject    handle to ans_bpm_c08 (see GCBO)
2818 % eventdata  reserved - to be defined in a future version of MATLAB
2819 % handles    structure with handles and user data (see GUIDATA)
2820 
2821 % Hints: get(hObject,'String') returns contents of ans_bpm_c08 as text
2822 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c08 as a double
2823 ext_offset=str2double(get(handles.ext_offset,'String'));
2824 delay=str2double(get(hObject,'String'))+ext_offset;
2825 tango_write_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2826 
2827 
2828 % --- Executes during object creation, after setting all properties.
2829 function ans_bpm_c08_CreateFcn(hObject, eventdata, handles)
2830 % hObject    handle to ans_bpm_c08 (see GCBO)
2831 % eventdata  reserved - to be defined in a future version of MATLAB
2832 % handles    empty - handles not created until after all CreateFcns called
2833 
2834 % Hint: edit controls usually have a white background on Windows.
2835 %       See ISPC and COMPUTER.
2836 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2837     set(hObject,'BackgroundColor','white');
2838 end
2839 
2840 
2841 
2842 function ans_bpm_c09_Callback(hObject, eventdata, handles)
2843 % hObject    handle to ans_bpm_c09 (see GCBO)
2844 % eventdata  reserved - to be defined in a future version of MATLAB
2845 % handles    structure with handles and user data (see GUIDATA)
2846 
2847 % Hints: get(hObject,'String') returns contents of ans_bpm_c09 as text
2848 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c09 as a double
2849 ext_offset=str2double(get(handles.ext_offset,'String'));
2850 delay=str2double(get(hObject,'String'))+ext_offset;
2851 tango_write_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2852 
2853 
2854 % --- Executes during object creation, after setting all properties.
2855 function ans_bpm_c09_CreateFcn(hObject, eventdata, handles)
2856 % hObject    handle to ans_bpm_c09 (see GCBO)
2857 % eventdata  reserved - to be defined in a future version of MATLAB
2858 % handles    empty - handles not created until after all CreateFcns called
2859 
2860 % Hint: edit controls usually have a white background on Windows.
2861 %       See ISPC and COMPUTER.
2862 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2863     set(hObject,'BackgroundColor','white');
2864 end
2865 
2866 
2867 
2868 function ans_bpm_c10_Callback(hObject, eventdata, handles)
2869 % hObject    handle to ans_bpm_c10 (see GCBO)
2870 % eventdata  reserved - to be defined in a future version of MATLAB
2871 % handles    structure with handles and user data (see GUIDATA)
2872 
2873 % Hints: get(hObject,'String') returns contents of ans_bpm_c10 as text
2874 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c10 as a double
2875 ext_offset=str2double(get(handles.ext_offset,'String'));
2876 delay=str2double(get(hObject,'String'))+ext_offset;
2877 tango_write_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2878 
2879 
2880 % --- Executes during object creation, after setting all properties.
2881 function ans_bpm_c10_CreateFcn(hObject, eventdata, handles)
2882 % hObject    handle to ans_bpm_c10 (see GCBO)
2883 % eventdata  reserved - to be defined in a future version of MATLAB
2884 % handles    empty - handles not created until after all CreateFcns called
2885 
2886 % Hint: edit controls usually have a white background on Windows.
2887 %       See ISPC and COMPUTER.
2888 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2889     set(hObject,'BackgroundColor','white');
2890 end
2891 
2892 
2893 
2894 function ans_bpm_c11_Callback(hObject, eventdata, handles)
2895 % hObject    handle to ans_bpm_c11 (see GCBO)
2896 % eventdata  reserved - to be defined in a future version of MATLAB
2897 % handles    structure with handles and user data (see GUIDATA)
2898 
2899 % Hints: get(hObject,'String') returns contents of ans_bpm_c11 as text
2900 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c11 as a double
2901 ext_offset=str2double(get(handles.ext_offset,'String'));
2902 delay=str2double(get(hObject,'String'))+ext_offset;
2903 tango_write_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2904 
2905 
2906 % --- Executes during object creation, after setting all properties.
2907 function ans_bpm_c11_CreateFcn(hObject, eventdata, handles)
2908 % hObject    handle to ans_bpm_c11 (see GCBO)
2909 % eventdata  reserved - to be defined in a future version of MATLAB
2910 % handles    empty - handles not created until after all CreateFcns called
2911 
2912 % Hint: edit controls usually have a white background on Windows.
2913 %       See ISPC and COMPUTER.
2914 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2915     set(hObject,'BackgroundColor','white');
2916 end
2917 
2918 
2919 
2920 function ans_bpm_c12_Callback(hObject, eventdata, handles)
2921 % hObject    handle to ans_bpm_c12 (see GCBO)
2922 % eventdata  reserved - to be defined in a future version of MATLAB
2923 % handles    structure with handles and user data (see GUIDATA)
2924 
2925 % Hints: get(hObject,'String') returns contents of ans_bpm_c12 as text
2926 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c12 as a double
2927 ext_offset=str2double(get(handles.ext_offset,'String'));
2928 delay=str2double(get(hObject,'String'))+ext_offset;
2929 tango_write_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2930 
2931 
2932 % --- Executes during object creation, after setting all properties.
2933 function ans_bpm_c12_CreateFcn(hObject, eventdata, handles)
2934 % hObject    handle to ans_bpm_c12 (see GCBO)
2935 % eventdata  reserved - to be defined in a future version of MATLAB
2936 % handles    empty - handles not created until after all CreateFcns called
2937 
2938 % Hint: edit controls usually have a white background on Windows.
2939 %       See ISPC and COMPUTER.
2940 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2941     set(hObject,'BackgroundColor','white');
2942 end
2943 
2944 
2945 
2946 function ans_bpm_c13_Callback(hObject, eventdata, handles)
2947 % hObject    handle to ans_bpm_c13 (see GCBO)
2948 % eventdata  reserved - to be defined in a future version of MATLAB
2949 % handles    structure with handles and user data (see GUIDATA)
2950 
2951 % Hints: get(hObject,'String') returns contents of ans_bpm_c13 as text
2952 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c13 as a double
2953 ext_offset=str2double(get(handles.ext_offset,'String'));
2954 delay=str2double(get(hObject,'String'))+ext_offset;
2955 tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2956 
2957 
2958 % --- Executes during object creation, after setting all properties.
2959 function ans_bpm_c13_CreateFcn(hObject, eventdata, handles)
2960 % hObject    handle to ans_bpm_c13 (see GCBO)
2961 % eventdata  reserved - to be defined in a future version of MATLAB
2962 % handles    empty - handles not created until after all CreateFcns called
2963 
2964 % Hint: edit controls usually have a white background on Windows.
2965 %       See ISPC and COMPUTER.
2966 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2967     set(hObject,'BackgroundColor','white');
2968 end
2969 
2970 
2971 
2972 function ans_bpm_c14_Callback(hObject, eventdata, handles)
2973 % hObject    handle to ans_bpm_c14 (see GCBO)
2974 % eventdata  reserved - to be defined in a future version of MATLAB
2975 % handles    structure with handles and user data (see GUIDATA)
2976 
2977 % Hints: get(hObject,'String') returns contents of ans_bpm_c14 as text
2978 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c14 as a double
2979 ext_offset=str2double(get(handles.ext_offset,'String'));
2980 delay=str2double(get(hObject,'String'))+ext_offset;
2981 tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2982 
2983 
2984 % --- Executes during object creation, after setting all properties.
2985 function ans_bpm_c14_CreateFcn(hObject, eventdata, handles)
2986 % hObject    handle to ans_bpm_c14 (see GCBO)
2987 % eventdata  reserved - to be defined in a future version of MATLAB
2988 % handles    empty - handles not created until after all CreateFcns called
2989 
2990 % Hint: edit controls usually have a white background on Windows.
2991 %       See ISPC and COMPUTER.
2992 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2993     set(hObject,'BackgroundColor','white');
2994 end
2995 
2996 
2997 
2998 function ans_bpm_c15_Callback(hObject, eventdata, handles)
2999 % hObject    handle to ans_bpm_c15 (see GCBO)
3000 % eventdata  reserved - to be defined in a future version of MATLAB
3001 % handles    structure with handles and user data (see GUIDATA)
3002 
3003 % Hints: get(hObject,'String') returns contents of ans_bpm_c15 as text
3004 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c15 as a double
3005 ext_offset=str2double(get(handles.ext_offset,'String'));
3006 delay=str2double(get(hObject,'String'))+ext_offset;
3007 tango_write_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
3008 
3009 
3010 % --- Executes during object creation, after setting all properties.
3011 function ans_bpm_c15_CreateFcn(hObject, eventdata, handles)
3012 % hObject    handle to ans_bpm_c15 (see GCBO)
3013 % eventdata  reserved - to be defined in a future version of MATLAB
3014 % handles    empty - handles not created until after all CreateFcns called
3015 
3016 % Hint: edit controls usually have a white background on Windows.
3017 %       See ISPC and COMPUTER.
3018 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3019     set(hObject,'BackgroundColor','white');
3020 end
3021 
3022 
3023 
3024 function ans_bpm_c16_Callback(hObject, eventdata, handles)
3025 % hObject    handle to ans_bpm_c16 (see GCBO)
3026 % eventdata  reserved - to be defined in a future version of MATLAB
3027 % handles    structure with handles and user data (see GUIDATA)
3028 
3029 % Hints: get(hObject,'String') returns contents of ans_bpm_c16 as text
3030 %        str2double(get(hObject,'String')) returns contents of ans_bpm_c16 as a double
3031 ext_offset=str2double(get(handles.ext_offset,'String'));
3032 delay=str2double(get(hObject,'String'))+ext_offset;
3033 tango_write_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
3034 
3035 
3036 % --- Executes during object creation, after setting all properties.
3037 function ans_bpm_c16_CreateFcn(hObject, eventdata, handles)
3038 % hObject    handle to ans_bpm_c16 (see GCBO)
3039 % eventdata  reserved - to be defined in a future version of MATLAB
3040 % handles    empty - handles not created until after all CreateFcns called
3041 
3042 % Hint: edit controls usually have a white background on Windows.
3043 %       See ISPC and COMPUTER.
3044 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3045     set(hObject,'BackgroundColor','white');
3046 end
3047 
3048 
3049 
3050 function edit_filling_relecture_tables_Callback(hObject, eventdata, handles)
3051 % hObject    handle to edit_filling_relecture_tables (see GCBO)
3052 % eventdata  reserved - to be defined in a future version of MATLAB
3053 % handles    structure with handles and user data (see GUIDATA)
3054 
3055 % Hints: get(hObject,'String') returns contents of edit_filling_relecture_tables as text
3056 %        str2double(get(hObject,'String')) returns contents of edit_filling_relecture_tables as a double
3057 
3058 
3059 % --- Executes during object creation, after setting all properties.
3060 function edit_filling_relecture_tables_CreateFcn(hObject, eventdata, handles)
3061 % hObject    handle to edit_filling_relecture_tables (see GCBO)
3062 % eventdata  reserved - to be defined in a future version of MATLAB
3063 % handles    empty - handles not created until after all CreateFcns called
3064 
3065 % Hint: edit controls usually have a white background on Windows.
3066 %       See ISPC and COMPUTER.
3067 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3068     set(hObject,'BackgroundColor','white');
3069 end
3070 
3071 
3072 
3073 function edit_filling_relecture_bunch_Callback(hObject, eventdata, handles)
3074 % hObject    handle to edit_filling_relecture_bunch (see GCBO)
3075 % eventdata  reserved - to be defined in a future version of MATLAB
3076 % handles    structure with handles and user data (see GUIDATA)
3077 
3078 % Hints: get(hObject,'String') returns contents of edit_filling_relecture_bunch as text
3079 %        str2double(get(hObject,'String')) returns contents of edit_filling_relecture_bunch as a double
3080 
3081 
3082 % --- Executes during object creation, after setting all properties.
3083 function edit_filling_relecture_bunch_CreateFcn(hObject, eventdata, handles)
3084 % hObject    handle to edit_filling_relecture_bunch (see GCBO)
3085 % eventdata  reserved - to be defined in a future version of MATLAB
3086 % handles    empty - handles not created until after all CreateFcns called
3087 
3088 % Hint: edit controls usually have a white background on Windows.
3089 %       See ISPC and COMPUTER.
3090 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3091     set(hObject,'BackgroundColor','white');
3092 end
3093 
3094 
3095 
3096 function edit_filling_entrer_bunch_Callback(hObject, eventdata, handles)
3097 % hObject    handle to edit_filling_entrer_bunch (see GCBO)
3098 % eventdata  reserved - to be defined in a future version of MATLAB
3099 % handles    structure with handles and user data (see GUIDATA)
3100 
3101 % Hints: get(hObject,'String') returns contents of edit_filling_entrer_bunch as text
3102 %        str2double(get(hObject,'String')) returns contents of edit_filling_entrer_bunch as a double
3103 % temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
3104 % offset_ext=temp.value(1)*52;
3105 % offset_linac=str2double(get(handles.lin_canon_spm_fin,'String')) ;% délai fin de réglage en ns
3106 % offset_linac=offset_linac/handles.lin_fin_step;                   % délai fin de réglage en pas de handles.lin_fin_step ps
3107 % bjump=handles.one_bunch;
3108 %
3109 % bunch=str2num(get(hObject,'String'));
3110 % [dtour,dpaquet]=bucketnumber(bunch);
3111 % dpaquet=dpaquet*bjump+offset_linac;
3112 % table=int32([length(bunch) dtour dpaquet]);
3113 % tango_command_inout('ANS/SY/CENTRAL','SetTables',table);
3114 % temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
3115 % n=temp.value;
3116 % temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
3117 % table_ext=temp.value(1:n); %-offset_ext;
3118 % temp=tango_read_attribute2('ANS/SY/CENTRAL', 'LinacDelayTable');
3119 % table_linac=(temp.value(1:n)-offset_linac)/bjump;
3120 % table=[];
3121 % for i=1:n
3122 %     table=[table ' ' '(' num2str([table_ext(i)])  ' '  num2str([table_linac(i)]) ')'];
3123 % end
3124 % set(handles.edit_filling_relecture_tables,'String',[num2str(table)]);
3125 % set(handles.edit_filling_relecture_bunch, 'String',[num2str(bunch)]);
3126 
3127 
3128 % --- Executes during object creation, after setting all properties.
3129 function edit_filling_entrer_bunch_CreateFcn(hObject, eventdata, handles)
3130 % hObject    handle to edit_filling_entrer_bunch (see GCBO)
3131 % eventdata  reserved - to be defined in a future version of MATLAB
3132 % handles    empty - handles not created until after all CreateFcns called
3133 
3134 % Hint: edit controls usually have a white background on Windows.
3135 %       See ISPC and COMPUTER.
3136 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3137     set(hObject,'BackgroundColor','white');
3138 end
3139 
3140 
3141 % --- Executes on button press in button_update.
3142 function button_update_Callback(hObject, eventdata, handles)
3143 % hObject    handle to button_update (see GCBO)
3144 % eventdata  reserved - to be defined in a future version of MATLAB
3145 % handles    structure with handles and user data (see GUIDATA)
3146 
3147 fprintf('*****Update des 16 cartes locales******\n')
3148 %r=tango_command_inout2('ANS/SY/LOCAL.SDC.1',  'Update');retour_update('ANS/SY/LOCAL.SDC.1',r);
3149 r=tango_command_inout2('LIN/SY/LOCAL.LPM.1','Update');retour_update('LIN/SY/LOCAL.LPM.1',r);
3150 r=tango_command_inout2('LIN/SY/LOCAL.SPM.1','Update');retour_update('LIN/SY/LOCAL.SPM.1',r);
3151 
3152 r=tango_command_inout2('BOO/SY/LOCAL.Binj.1',  'Update');    retour_update('BOO/SY/LOCAL.Binj.1',r);
3153 r=tango_command_inout2('BOO/SY/LOCAL.Alim.1',  'Update'); retour_update('BOO/SY/LOCAL.Alim.1',r);
3154 r=tango_command_inout2('BOO/SY/LOCAL.DG.3', 'Update');retour_update('BOO/SY/LOCAL.DG.3',r);
3155 r=tango_command_inout2('BOO/SY/LOCAL.Bext.1',  'Update');retour_update('BOO/SY/LOCAL.Bext.1',r);
3156 
3157 r=tango_command_inout2('ANS-C01/SY/LOCAL.Ainj.1', 'Update');retour_update('ANS-C01/SY/LOCAL.Ainj.1',r);
3158 r=tango_command_inout2('ANS-C01/SY/LOCAL.Ainj.2',  'Update');retour_update('ANS-C01/SY/LOCAL.Ainj.2',r);
3159 r=tango_command_inout2('ANS-C01/SY/LOCAL.DG.2',  'Update');retour_update('ANS-C01/SY/LOCAL.DG.2',r);
3160 r=tango_command_inout2('ANS-C03/SY/LOCAL.DG.1',  'Update');retour_update('ANS-C03/SY/LOCAL.DG.1',r);
3161 r=tango_command_inout2('ANS-C05/SY/LOCAL.DG.1',  'Update');retour_update('ANS-C05/SY/LOCAL.DG.1',r);
3162 r=tango_command_inout2('ANS-C07/SY/LOCAL.DG.1', 'Update');retour_update('ANS-C07/SY/LOCAL.DG.1',r);
3163 r=tango_command_inout2('ANS-C09/SY/LOCAL.DG.1',  'Update');retour_update('ANS-C09/SY/LOCAL.DG.1',r);
3164 r=tango_command_inout2('ANS-C11/SY/LOCAL.DG.1', 'Update');retour_update('ANS-C11/SY/LOCAL.DG.1',r);
3165 r=tango_command_inout2('ANS-C13/SY/LOCAL.DG.1',  'Update');retour_update('ANS-C13/SY/LOCAL.DG.1',r);
3166 r=tango_command_inout2('ANS-C15/SY/LOCAL.DG.1',  'Update'); retour_update('ANS-C15/SY/LOCAL.DG.1',r);
3167 r=tango_command_inout2('ANS/SY/LOCAL.SDC.1',  'Update');retour_update('ANS/SY/LOCAL.SDC.1',r);
3168 fprintf('**************************************\n')
3169 %retour_command=vect
3170 %fprintf('16 zéro = OK : %d\n',vect)
3171 
3172 % --- Executes on button press in button_acquisition_trigstatus.
3173 function button_acquisition_trigstatus_Callback(hObject, eventdata, handles)
3174 % hObject    handle to button_acquisition_trigstatus (see GCBO)
3175 % eventdata  reserved - to be defined in a future version of MATLAB
3176 % handles    structure with handles and user data (see GUIDATA)
3177 
3178 set(handles.inj_offset,'Enable','off');
3179 set(handles.sdc1,'Enable','off');
3180 set(handles.lin_canon_lpm,'Enable','off');
3181 set(handles.boo_bpm,'Enable','off');
3182 set(handles.lt1_emittance,'Enable','off');
3183 set(handles.lt1_MC1,'Enable','off');
3184 set(handles.lt1_MC2,'Enable','off');
3185 set(handles.lt1_osc,'Enable','off');
3186 set(handles.boo_dcct,'Enable','off');
3187 set(handles.boo_nod,'Enable','off');
3188 set(handles.boo_inj_septum,'Enable','off');
3189 set(handles.boo_inj_kicker,'Enable','off');
3190 set(handles.boo_alim_dipole,'Enable','off');
3191 set(handles.boo_alim_qf,'Enable','off');
3192 set(handles.boo_alim_qd,'Enable','off');
3193 set(handles.boo_alim_sf,'Enable','off');
3194 set(handles.boo_alim_sd,'Enable','off');
3195 set(handles.boo_rf,'Enable','off');
3196 set(handles.lin_modulateur,'Enable','off');
3197 set(handles.ext_offset,'Enable','off');
3198 set(handles.boo_ext_dof,'Enable','off');
3199 set(handles.boo_ext_sept_p,'Enable','off');
3200 set(handles.boo_ext_sept_a,'Enable','off');
3201 set(handles.boo_ext_kicker,'Enable','off');
3202 set(handles.sdc2,'Enable','off');
3203 set(handles.lt2_emittance,'Enable','off');
3204 set(handles.lt2_osc,'Enable','off');
3205 set(handles.lt2_bpm,'Enable','off');
3206 set(handles.ans_inj_k1,'Enable','off');
3207 set(handles.ans_inj_k2,'Enable','off');
3208 set(handles.ans_inj_k3,'Enable','off');
3209 set(handles.ans_inj_k4,'Enable','off');
3210 set(handles.ans_inj_sept_p,'Enable','off');
3211 set(handles.ans_inj_sept_a,'Enable','off');
3212 set(handles.ans_bpm,'Enable','off');
3213 set(handles.ans_dcct,'Enable','off');
3214 set(handles.ans_bpm_c01,'Enable','off');
3215 set(handles.ans_bpm_c02,'Enable','off');
3216 set(handles.ans_bpm_c03,'Enable','off');
3217 set(handles.ans_bpm_c04,'Enable','off');
3218 set(handles.ans_bpm_c05,'Enable','off');
3219 set(handles.ans_bpm_c06,'Enable','off');
3220 set(handles.ans_bpm_c07,'Enable','off');
3221 set(handles.ans_bpm_c08,'Enable','off');
3222 set(handles.ans_bpm_c09,'Enable','off');
3223 set(handles.ans_bpm_c10,'Enable','off');
3224 set(handles.ans_bpm_c11,'Enable','off');
3225 set(handles.ans_bpm_c12,'Enable','off');
3226 set(handles.ans_bpm_c13,'Enable','off');
3227 set(handles.ans_bpm_c14,'Enable','off');
3228 set(handles.ans_bpm_c15,'Enable','off');
3229 set(handles.ans_bpm_c16,'Enable','off');
3230 
3231 
3232 n=1;
3233 
3234 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay');
3235 set(handles.central_pc,'String',num2str(temp.value(n)));
3236 
3237 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
3238 set(handles.central_inj,'String',num2str(temp.value(n)));
3239 
3240 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
3241 set(handles.central_soft,'String',num2str(temp.value(n)));
3242 
3243 temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue');
3244 set(handles.central_ext,'String',num2str(temp.value(n)));
3245 
3246 
3247 
3248 temp=tango_read_attribute2('ANS/SY/LOCAL.SDC.1', 'oscTrigStatus');
3249 set(handles.sdc1,'String',num2str(temp.value(n)));
3250 
3251 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmTrigStatus');
3252 set(handles.lin_canon_lpm,'String',num2str(temp.value(n)));
3253 
3254 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigTrigStatus');
3255 set(handles.boo_bpm,'String',num2str(temp.value(n)));
3256 
3257 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceTrigStatus');
3258 set(handles.lt1_emittance,'String',num2str(temp.value(n)));
3259 
3260 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1TrigStatus');
3261 set(handles.lt1_MC1,'String',num2str(temp.value(n)));
3262 
3263 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2TrigStatus');
3264 set(handles.lt1_MC2,'String',num2str(temp.value(n)));
3265 
3266 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'oscTrigStatus');
3267 set(handles.lt1_osc,'String',num2str(temp.value(n)));
3268 
3269 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booTrigStatus');
3270 set(handles.boo_dcct,'String',num2str(temp.value(n)));
3271 
3272 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigTrigStatus');
3273 set(handles.boo_nod,'String',num2str(temp.value(n)));
3274 
3275 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigTrigStatus');
3276 set(handles.boo_inj_septum,'String',num2str(temp.value(n)));
3277 
3278 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigTrigStatus');
3279 set(handles.boo_inj_kicker,'String',num2str(temp.value(n)));
3280 
3281 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'dpTrigStatus');
3282 set(handles.boo_alim_dipole,'String',num2str(temp.value(n)));
3283 
3284 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTrigStatus');
3285 set(handles.boo_alim_qf,'String',num2str(temp.value(n)));
3286 
3287 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTrigStatus');
3288 set(handles.boo_alim_qd,'String',num2str(temp.value(n)));
3289 
3290 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'sfTrigStatus');
3291 set(handles.boo_alim_sf,'String',num2str(temp.value(n)));
3292 
3293 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'sdTrigStatus');
3294 set(handles.boo_alim_sd,'String',num2str(temp.value(n)));
3295 
3296 temp=tango_read_attribute2('BOO/SY/LOCAL.RF.1', 'rfTrigStatus');
3297 set(handles.boo_rf,'String',num2str(temp.value(n)));
3298 
3299 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTrigStatus');
3300 set(handles.lin_modulateur,'String',num2str(temp.value(n)));
3301 
3302 
3303 
3304 
3305 
3306 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTrigStatus');
3307 set(handles.boo_ext_dof,'String',num2str(temp.value(n)));
3308 
3309 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTrigStatus');
3310 set(handles.boo_ext_sept_p,'String',num2str(temp.value(n)));
3311 
3312 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTrigStatus');
3313 set(handles.boo_ext_sept_a,'String',num2str(temp.value(n)));
3314 
3315 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTrigStatus');
3316 set(handles.boo_ext_kicker,'String',num2str(temp.value(n)));
3317 
3318 
3319 
3320 temp=tango_read_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTrigStatus');
3321 set(handles.sdc2,'String',num2str(temp.value(n)));
3322 
3323 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTrigStatus');
3324 set(handles.lt2_emittance,'String',num2str(temp.value(n)));
3325 
3326 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTrigStatus');
3327 set(handles.lt2_osc,'String',num2str(temp.value(n)));
3328 
3329 temp=tango_read_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTrigStatus');
3330 set(handles.lt2_bpm,'String',num2str(temp.value(n)));
3331 
3332 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTrigStatus');
3333 set(handles.ans_inj_k1,'String',num2str(temp.value(n)));
3334 
3335 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTrigStatus');
3336 set(handles.ans_inj_k2,'String',num2str(temp.value(n)));
3337 
3338 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTrigStatus');
3339 set(handles.ans_inj_k3,'String',num2str(temp.value(n)));
3340 
3341 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTrigStatus');
3342 set(handles.ans_inj_k4,'String',num2str(temp.value(n)));
3343 
3344 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTrigStatus');
3345 set(handles.ans_inj_sept_p,'String',num2str(temp.value(n)));
3346 
3347 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTrigStatus');
3348 set(handles.ans_inj_sept_a,'String',num2str(temp.value(n)));
3349 
3350 temp=tango_read_attribute2('ANS-C13/SY/LOCAL.DG.1', 'dcctTrigStatus');
3351 set(handles.ans_dcct,'String',num2str(temp.value(n)));
3352 
3353 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTrigStatus');
3354 set(handles.ans_bpm,'String',num2str(temp.value(n)));
3355 set(handles.ans_bpm_c01,'String',num2str(temp.value(n)));
3356 
3357 temp=tango_read_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3358 set(handles.ans_bpm_c02,'String',num2str(temp.value(n)));
3359 temp=tango_read_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3360 set(handles.ans_bpm_c03,'String',num2str(temp.value(n)));
3361 temp=tango_read_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3362 set(handles.ans_bpm_c04,'String',num2str(temp.value(n)));
3363 temp=tango_read_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3364 set(handles.ans_bpm_c05,'String',num2str(temp.value(n)));
3365 temp=tango_read_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3366 set(handles.ans_bpm_c06,'String',num2str(temp.value(n)));
3367 temp=tango_read_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3368 set(handles.ans_bpm_c07,'String',num2str(temp.value(n)));
3369 temp=tango_read_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3370 set(handles.ans_bpm_c08,'String',num2str(temp.value(n)));
3371 temp=tango_read_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3372 set(handles.ans_bpm_c09,'String',num2str(temp.value(n)));
3373 temp=tango_read_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3374 set(handles.ans_bpm_c10,'String',num2str(temp.value(n)));
3375 temp=tango_read_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3376 set(handles.ans_bpm_c11,'String',num2str(temp.value(n)));
3377 temp=tango_read_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3378 set(handles.ans_bpm_c12,'String',num2str(temp.value(n)));
3379 temp=tango_read_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3380 set(handles.ans_bpm_c13,'String',num2str(temp.value(n)));
3381 temp=tango_read_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3382 set(handles.ans_bpm_c14,'String',num2str(temp.value(n)));
3383 temp=tango_read_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3384 set(handles.ans_bpm_c15,'String',num2str(temp.value(n)));
3385 temp=tango_read_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTrigStatus');
3386 set(handles.ans_bpm_c16,'String',num2str(temp.value(n)));
3387 
3388 
3389 
3390 % --- Executes on button press in togglebutton2.
3391 function togglebutton2_Callback(hObject, eventdata, handles)
3392 % hObject    handle to togglebutton2 (see GCBO)
3393 % eventdata  reserved - to be defined in a future version of MATLAB
3394 % handles    structure with handles and user data (see GUIDATA)
3395 
3396 % Hint: get(hObject,'Value') returns toggle state of togglebutton2
3397 
3398 
3399 % --- Executes on selection change in listbox_fillingmode.
3400 function listbox_fillingmode_Callback(hObject, eventdata, handles)
3401 % hObject    handle to listbox_fillingmode (see GCBO)
3402 % eventdata  reserved - to be defined in a future version of MATLAB
3403 % handles    structure with handles and user data (see GUIDATA)
3404 
3405 % Hints: contents = get(hObject,'String') returns listbox_fillingmode contents as cell array
3406 %        contents{get(hObject,'Value')} returns selected item from listbox_fillingmode
3407 pattern=get(hObject,'String');
3408 mode=get(hObject,'Value');
3409 fprintf('***************************************************\n')
3410 fprintf('Mode de remplissage sélectionné : %s\n',pattern{mode})
3411 fprintf('***************************************************\n')
3412 
3413 % Prépare les tables pour le 3 Hz
3414 quart=[1 105 209 313];
3415 temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
3416 offset_ext=temp.value(1)*52;
3417 offset_linac=str2double(get(handles.lin_canon_spm_fin,'String')) ;% délai fin de réglage en ns
3418 offset_linac=offset_linac/handles.lin_fin_step;                   % délai fin de réglage en pas de handles.lin_fin_step ps
3419 bjump=handles.one_bunch;
3420 
3421 
3422 if (mode<=4)    %LPM
3423     bunch=quart(mode);
3424 elseif (mode>4)&&(mode<=7) %LPM
3425     bunch=quart(1:(mode-3));
3426 elseif (mode==8)    %LPM
3427     dbunch=4*8;
3428     bunch=(0:12)*dbunch;
3429 elseif (mode==9)   % SPM    1 paquet
3430     bunch=[1];
3431 elseif (mode==10)  % SPM    8 paquets
3432     bunch=[0:7]*52+1;
3433 elseif (mode==11)  % SPM    16 paquets
3434     bunch=[0:15]*26+1;
3435 elseif (mode==12)  % SPM    n paquets
3436    bunch=str2num(get(handles.edit_filling_entrer_bunch,'String'));
3437 elseif (mode==13)  % SPM    n paquets
3438     paq=str2num(get(handles.edit_filling_entrer_bunch1,'String'));
3439     bunch=paq(1):paq(2);
3440 end
3441 
3442 
3443 [dtour,dpaquet]=bucketnumber(bunch);
3444 dpaquet=dpaquet*bjump+offset_linac;
3445 table=int32([length(bunch) dtour dpaquet]);
3446 handles.table=table;
3447 handles.bunch=bunch;
3448 
3449 
3450 modeinj=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
3451 if strcmp(modeinj,'togglebutton_soft')  % on rempli la table sur paquet 1 par défaut
3452     table=handles.table0;
3453     tango_command_inout('ANS/SY/CENTRAL','SetTables',table);
3454     
3455 elseif strcmp(modeinj,'togglebutton_3Hz') % on rempli la table
3456     tango_command_inout('ANS/SY/CENTRAL','SetTables',table);
3457     temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
3458     n=temp.value;
3459     temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
3460     table_ext=temp.value(1:n); %-offset_ext;
3461     temp=tango_read_attribute2('ANS/SY/CENTRAL', 'LinacDelayTable');
3462     table_linac=(temp.value(1:n)-offset_linac)/bjump;
3463     table=[];
3464     for i=1:n
3465         table=[table ' ' '(' num2str([table_ext(i)])  ' '  num2str([table_linac(i)]) ')'];
3466     end
3467 end
3468 
3469 set(handles.edit_filling_relecture_tables,'String',[num2str(table)]);
3470 set(handles.edit_filling_relecture_bunch, 'String',[num2str(bunch)]);
3471 
3472 
3473 guidata(hObject, handles);
3474 
3475 
3476 % --- Executes during object creation, after setting all properties.
3477 function listbox_fillingmode_CreateFcn(hObject, eventdata, handles)
3478 % hObject    handle to listbox_fillingmode (see GCBO)
3479 % eventdata  reserved - to be defined in a future version of MATLAB
3480 % handles    empty - handles not created until after all CreateFcns called
3481 
3482 % Hint: listbox controls usually have a white background on Windows.
3483 %       See ISPC and COMPUTER.
3484 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3485     set(hObject,'BackgroundColor','white');
3486 end
3487 
3488 
3489 % --- Executes on button press in button_fix.
3490 function button_fix_Callback(hObject, eventdata, handles)
3491 % hObject    handle to button_fix (see GCBO)
3492 % eventdata  reserved - to be defined in a future version of MATLAB
3493 % handles    structure with handles and user data (see GUIDATA)
3494 
3495 [clk_pc,clk_soft]=fix_quart;
3496 handles.clk_pc  =clk_pc;
3497 handles.clk_soft=clk_soft;
3498 
3499 % n=1;
3500 % temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcStepDelay');
3501 % clk1=temp.value(n);
3502 % temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
3503 % clk2=temp.value(n);
3504 %
3505 % jump=int32([0 39 26 13]);
3506 % handles.clk_pc  =jump +  int32(clk1);
3507 % handles.clk_soft=jump  + int32(clk2);
3508 
3509 guidata(hObject, handles);
3510 
3511 
3512 
3513 function edit_Nshot_soft_Callback(hObject, eventdata, handles)
3514 % hObject    handle to edit_Nshot_soft (see GCBO)
3515 % eventdata  reserved - to be defined in a future version of MATLAB
3516 % handles    structure with handles and user data (see GUIDATA)
3517 
3518 % Hints: get(hObject,'String') returns contents of edit_Nshot_soft as text
3519 %        str2double(get(hObject,'String')) returns contents of edit_Nshot_soft as a double
3520 
3521 
3522 % --- Executes during object creation, after setting all properties.
3523 function edit_Nshot_soft_CreateFcn(hObject, eventdata, handles)
3524 % hObject    handle to edit_Nshot_soft (see GCBO)
3525 % eventdata  reserved - to be defined in a future version of MATLAB
3526 % handles    empty - handles not created until after all CreateFcns called
3527 
3528 % Hint: edit controls usually have a white background on Windows.
3529 %       See ISPC and COMPUTER.
3530 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3531     set(hObject,'BackgroundColor','white');
3532 end
3533 
3534 
3535 
3536 function edit_laps_Callback(hObject, eventdata, handles)
3537 % hObject    handle to edit_laps (see GCBO)
3538 % eventdata  reserved - to be defined in a future version of MATLAB
3539 % handles    structure with handles and user data (see GUIDATA)
3540 
3541 % Hints: get(hObject,'String') returns contents of edit_laps as text
3542 %        str2double(get(hObject,'String')) returns contents of edit_laps as a double
3543 
3544 
3545 % --- Executes during object creation, after setting all properties.
3546 function edit_laps_CreateFcn(hObject, eventdata, handles)
3547 % hObject    handle to edit_laps (see GCBO)
3548 % eventdata  reserved - to be defined in a future version of MATLAB
3549 % handles    empty - handles not created until after all CreateFcns called
3550 
3551 % Hint: edit controls usually have a white background on Windows.
3552 %       See ISPC and COMPUTER.
3553 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3554     set(hObject,'BackgroundColor','white');
3555 end
3556 
3557 
3558 
3559 function edit_qlt1_Callback(hObject, eventdata, handles)
3560 % hObject    handle to edit_qlt1 (see GCBO)
3561 % eventdata  reserved - to be defined in a future version of MATLAB
3562 % handles    structure with handles and user data (see GUIDATA)
3563 
3564 % Hints: get(hObject,'String') returns contents of edit_qlt1 as text
3565 %        str2double(get(hObject,'String')) returns contents of edit_qlt1 as a double
3566 
3567 
3568 % --- Executes during object creation, after setting all properties.
3569 function edit_qlt1_CreateFcn(hObject, eventdata, handles)
3570 % hObject    handle to edit_qlt1 (see GCBO)
3571 % eventdata  reserved - to be defined in a future version of MATLAB
3572 % handles    empty - handles not created until after all CreateFcns called
3573 
3574 % Hint: edit controls usually have a white background on Windows.
3575 %       See ISPC and COMPUTER.
3576 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3577     set(hObject,'BackgroundColor','white');
3578 end
3579 
3580 
3581 
3582 function edit_iboo_Callback(hObject, eventdata, handles)
3583 % hObject    handle to edit_iboo (see GCBO)
3584 % eventdata  reserved - to be defined in a future version of MATLAB
3585 % handles    structure with handles and user data (see GUIDATA)
3586 
3587 % Hints: get(hObject,'String') returns contents of edit_iboo as text
3588 %        str2double(get(hObject,'String')) returns contents of edit_iboo as a double
3589 
3590 
3591 % --- Executes during object creation, after setting all properties.
3592 function edit_iboo_CreateFcn(hObject, eventdata, handles)
3593 % hObject    handle to edit_iboo (see GCBO)
3594 % eventdata  reserved - to be defined in a future version of MATLAB
3595 % handles    empty - handles not created until after all CreateFcns called
3596 
3597 % Hint: edit controls usually have a white background on Windows.
3598 %       See ISPC and COMPUTER.
3599 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3600     set(hObject,'BackgroundColor','white');
3601 end
3602 
3603 
3604 
3605 function edit_dians_Callback(hObject, eventdata, handles)
3606 % hObject    handle to edit_dians (see GCBO)
3607 % eventdata  reserved - to be defined in a future version of MATLAB
3608 % handles    structure with handles and user data (see GUIDATA)
3609 
3610 % Hints: get(hObject,'String') returns contents of edit_dians as text
3611 %        str2double(get(hObject,'String')) returns contents of edit_dians as a double
3612 
3613 
3614 % --- Executes during object creation, after setting all properties.
3615 function edit_dians_CreateFcn(hObject, eventdata, handles)
3616 % hObject    handle to edit_dians (see GCBO)
3617 % eventdata  reserved - to be defined in a future version of MATLAB
3618 % handles    empty - handles not created until after all CreateFcns called
3619 
3620 % Hint: edit controls usually have a white background on Windows.
3621 %       See ISPC and COMPUTER.
3622 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3623     set(hObject,'BackgroundColor','white');
3624 end
3625 
3626 
3627 
3628 function edit_rlt1_Callback(hObject, eventdata, handles)
3629 % hObject    handle to edit_rlt1 (see GCBO)
3630 % eventdata  reserved - to be defined in a future version of MATLAB
3631 % handles    structure with handles and user data (see GUIDATA)
3632 
3633 % Hints: get(hObject,'String') returns contents of edit_rlt1 as text
3634 %        str2double(get(hObject,'String')) returns contents of edit_rlt1 as a double
3635 
3636 
3637 % --- Executes during object creation, after setting all properties.
3638 function edit_rlt1_CreateFcn(hObject, eventdata, handles)
3639 % hObject    handle to edit_rlt1 (see GCBO)
3640 % eventdata  reserved - to be defined in a future version of MATLAB
3641 % handles    empty - handles not created until after all CreateFcns called
3642 
3643 % Hint: edit controls usually have a white background on Windows.
3644 %       See ISPC and COMPUTER.
3645 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3646     set(hObject,'BackgroundColor','white');
3647 end
3648 
3649 
3650 
3651 function edit_rboo_Callback(hObject, eventdata, handles)
3652 % hObject    handle to edit_rboo (see GCBO)
3653 % eventdata  reserved - to be defined in a future version of MATLAB
3654 % handles    structure with handles and user data (see GUIDATA)
3655 
3656 % Hints: get(hObject,'String') returns contents of edit_rboo as text
3657 %        str2double(get(hObject,'String')) returns contents of edit_rboo as a double
3658 
3659 
3660 % --- Executes during object creation, after setting all properties.
3661 function edit_rboo_CreateFcn(hObject, eventdata, handles)
3662 % hObject    handle to edit_rboo (see GCBO)
3663 % eventdata  reserved - to be defined in a future version of MATLAB
3664 % handles    empty - handles not created until after all CreateFcns called
3665 
3666 % Hint: edit controls usually have a white background on Windows.
3667 %       See ISPC and COMPUTER.
3668 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3669     set(hObject,'BackgroundColor','white');
3670 end
3671 
3672 
3673 
3674 function edit_rans_Callback(hObject, eventdata, handles)
3675 % hObject    handle to edit_rans (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 
3679 % Hints: get(hObject,'String') returns contents of edit_rans as text
3680 %        str2double(get(hObject,'String')) returns contents of edit_rans as a double
3681 
3682 
3683 % --- Executes during object creation, after setting all properties.
3684 function edit_rans_CreateFcn(hObject, eventdata, handles)
3685 % hObject    handle to edit_rans (see GCBO)
3686 % eventdata  reserved - to be defined in a future version of MATLAB
3687 % handles    empty - handles not created until after all CreateFcns called
3688 
3689 % Hint: edit controls usually have a white background on Windows.
3690 %       See ISPC and COMPUTER.
3691 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3692     set(hObject,'BackgroundColor','white');
3693 end
3694 
3695 
3696 
3697 function edit_dians1_Callback(hObject, eventdata, handles)
3698 % hObject    handle to edit_dians1 (see GCBO)
3699 % eventdata  reserved - to be defined in a future version of MATLAB
3700 % handles    structure with handles and user data (see GUIDATA)
3701 
3702 % Hints: get(hObject,'String') returns contents of edit_dians1 as text
3703 %        str2double(get(hObject,'String')) returns contents of edit_dians1 as a double
3704 
3705 
3706 % --- Executes during object creation, after setting all properties.
3707 function edit_dians1_CreateFcn(hObject, eventdata, handles)
3708 % hObject    handle to edit_dians1 (see GCBO)
3709 % eventdata  reserved - to be defined in a future version of MATLAB
3710 % handles    empty - handles not created until after all CreateFcns called
3711 
3712 % Hint: edit controls usually have a white background on Windows.
3713 %       See ISPC and COMPUTER.
3714 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3715     set(hObject,'BackgroundColor','white');
3716 end
3717 
3718 
3719 
3720 function edit_cycle_Callback(hObject, eventdata, handles)
3721 % hObject    handle to edit_cycle (see GCBO)
3722 % eventdata  reserved - to be defined in a future version of MATLAB
3723 % handles    structure with handles and user data (see GUIDATA)
3724 
3725 % Hints: get(hObject,'String') returns contents of edit_cycle as text
3726 %        str2double(get(hObject,'String')) returns contents of edit_cycle as a double
3727 
3728 
3729 % --- Executes during object creation, after setting all properties.
3730 function edit_cycle_CreateFcn(hObject, eventdata, handles)
3731 % hObject    handle to edit_cycle (see GCBO)
3732 % eventdata  reserved - to be defined in a future version of MATLAB
3733 % handles    empty - handles not created until after all CreateFcns called
3734 
3735 % Hint: edit controls usually have a white background on Windows.
3736 %       See ISPC and COMPUTER.
3737 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3738     set(hObject,'BackgroundColor','white');
3739 end
3740 
3741 
3742 
3743 function edit_courant_total_Callback(hObject, eventdata, handles)
3744 % hObject    handle to edit_courant_total (see GCBO)
3745 % eventdata  reserved - to be defined in a future version of MATLAB
3746 % handles    structure with handles and user data (see GUIDATA)
3747 
3748 % Hints: get(hObject,'String') returns contents of edit_courant_total as text
3749 %        str2double(get(hObject,'String')) returns contents of edit_courant_total as a double
3750 
3751 
3752 % --- Executes during object creation, after setting all properties.
3753 function edit_courant_total_CreateFcn(hObject, eventdata, handles)
3754 % hObject    handle to edit_courant_total (see GCBO)
3755 % eventdata  reserved - to be defined in a future version of MATLAB
3756 % handles    empty - handles not created until after all CreateFcns called
3757 
3758 % Hint: edit controls usually have a white background on Windows.
3759 %       See ISPC and COMPUTER.
3760 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3761     set(hObject,'BackgroundColor','white');
3762 end
3763 
3764 
3765 
3766 function lin_canon_spm_Callback(hObject, eventdata, handles)
3767 % hObject    handle to lin_canon_spm (see GCBO)
3768 % eventdata  reserved - to be defined in a future version of MATLAB
3769 % handles    structure with handles and user data (see GUIDATA)
3770 
3771 % Hints: get(hObject,'String') returns contents of lin_canon_spm as text
3772 %        str2double(get(hObject,'String')) returns contents of lin_canon_spm as a double
3773 
3774 inj_offset=str2double(get(handles.inj_offset,'String'));
3775 delay=str2double(get(hObject,'String'))+inj_offset;
3776 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacTimeDelay',delay);
3777 
3778 
3779 % --- Executes during object creation, after setting all properties.
3780 function lin_canon_spm_CreateFcn(hObject, eventdata, handles)
3781 % hObject    handle to lin_canon_spm (see GCBO)
3782 % eventdata  reserved - to be defined in a future version of MATLAB
3783 % handles    empty - handles not created until after all CreateFcns called
3784 
3785 % Hint: edit controls usually have a white background on Windows.
3786 %       See ISPC and COMPUTER.
3787 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3788     set(hObject,'BackgroundColor','white');
3789 end
3790 
3791 
3792 function  uipanel_mode_CreateFcn(hObject, eventdata, handles)
3793 % hObject    handle to lin_canon_spm (see GCBO)
3794 % eventdata  reserved - to be defined in a future version of MATLAB
3795 % handles    empty - handles not created until after all CreateFcns called
3796 
3797 
3798 % % --------------------------------------------------------------------
3799  function uipanel_mode_SelectionChangeFcn(hObject, eventdata, handles)
3800 % % hObject    handle to uipanel_mode (see GCBO)
3801 % % eventdata  reserved - to be defined in a future version of MATLAB
3802 % % handles    structure with handles and user data (see GUIDATA)
3803 %
3804 
3805 modelinac=get(get(handles.uipanel_lpm_spm_mode,'SelectedObject'),'Tag');
3806 switch modelinac  % Get Tag of selected object
3807     case 'no_mode'
3808         eventlpm=int32(0);
3809         eventspm=int16(0);
3810     case 'lpm_mode'
3811         eventlpm=int32(5);
3812         eventspm=int16(0);
3813     case 'spm_mode'
3814         eventlpm=int32(0);
3815         eventspm=int16(5);
3816 end
3817 
3818 mode=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
3819 
3820 tout=0.;
3821 switch mode  % Get Tag of selected object
3822     case 'togglebutton_soft'
3823     % switch to soft
3824         event=int32(5) ;% adresse de l'injection
3825         tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'oscEvent',event); pause(tout);
3826         tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',eventlpm); pause(tout);
3827         tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',eventspm);
3828         tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareEvent',int32(1)); pause(tout);
3829         tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigEvent',event); pause(tout);
3830         tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-btd.trigEvent',event); pause(tout);
3831         tango_write_attribute2('BOO/SY/LOCAL.DG.2', 'bpm-btb.trigEvent',event); pause(tout);
3832         tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-btc.trigEvent',event); pause(tout);     
3833         tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceEvent',event); pause(tout);
3834         tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1Event',event); pause(tout);
3835         tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2Event',event); pause(tout);
3836         tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'oscEvent',event); pause(tout);
3837         tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booEvent',event); pause(tout);
3838         tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigEvent',event);pause(tout);
3839         tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigEvent',event); pause(tout);
3840         tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent',event);
3841         tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'spareEvent',event);pause(tout);
3842         tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigEvent',event);pause(tout);
3843         tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigEvent',event);pause(tout);
3844         tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigEvent',event);pause(tout);
3845         tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigEvent',event);pause(tout);
3846         tango_write_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigEvent',event);pause(tout);
3847         tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctEvent',event);pause(tout);
3848         tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvEvent',event);pause(tout);
3849         tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'emittanceEvent',event);pause(tout);
3850         arg.svalue={'k1.trig','k2.trig','k3.trig','k4.trig'}; arg.lvalue=int32([5 5 5 5]); 
3851         tango_command_inout('ANS-C01/SY/LOCAL.Ainj.1','SetEventsNumbers',arg);% chagement groupé addresses sans update
3852         %tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigEvent',event);pause(tout);
3853         %tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigEvent',event);pause(tout);
3854         %tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigEvent',event);pause(tout);
3855         %tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigEvent',event);pause(tout);
3856         tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigEvent',event);pause(tout);
3857         tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigEvent',event);pause(tout);
3858         tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'dcctEvent',int32(3));pause(tout);
3859         tango_write_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigEvent',event);pause(tout);
3860         tango_write_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3861         tango_write_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3862         tango_write_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3863         tango_write_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3864         tango_write_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3865         tango_write_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3866         tango_write_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3867         tango_write_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3868         tango_write_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3869         tango_write_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3870         tango_write_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3871         tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3872         tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3873         tango_write_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3874         tango_write_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);     
3875 
3876     % special modulateur
3877         inj_offset=str2double(get(handles.inj_offset,'String'));
3878         inj=str2double(get(handles.central_inj,'String'));
3879         soft=str2double(get(handles.central_soft,'String'));
3880         pc=str2double(get(handles.central_pc,'String'));
3881         temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
3882         delay=inj_offset+soft-pc;
3883         tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
3884         start_soft
3885      % special septum actif boo et ans
3886         r=(1-0.0004);
3887         boo=readattribute('BOO-C12/EP/AL_SEP_A.Ext/voltage'); boo=boo*r;
3888         writeattribute('BOO-C12/EP/AL_SEP_A.Ext/voltage,',boo);
3889         ans=readattribute('ANS-C01/EP/AL_SEP_A/voltage'); ans=ans*r;
3890         writeattribute('ANS-C01/EP/AL_SEP_A/voltage,',ans);     
3891            
3892     case 'togglebutton_3Hz'
3893     % switch to 3Hz
3894         event=int32(2) ;% adresse de l'injection
3895         tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'oscEvent',event); pause(tout);
3896         tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',int32(0)); pause(tout);
3897         tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',int16(0)); 
3898         tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareEvent',event); pause(tout);
3899         tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigEvent',event); pause(tout);
3900         tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-btd.trigEvent',event); pause(tout);
3901         tango_write_attribute2('BOO/SY/LOCAL.DG.2', 'bpm-btb.trigEvent',event); pause(tout);
3902         tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-btc.trigEvent',event); pause(tout); 
3903         tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceEvent',event); pause(tout);
3904         tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1Event',event); pause(tout);
3905         tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2Event',event); pause(tout);
3906         tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'oscEvent',event); pause(tout);
3907         tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booEvent',event); pause(tout);
3908         tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigEvent',event);pause(tout);
3909         tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigEvent',event); pause(tout);
3910         tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent',event);
3911         tango_command_inout2('BOO/SY/LOCAL.Binj.1',  'Reset');  % stop les trigs d'injection boo
3912         event=int32(3) ;% adresse de l'extraction
3913         tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'spareEvent',event);pause(tout);
3914         tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigEvent',event);pause(tout);
3915         tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigEvent',event);pause(tout);
3916         tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigEvent',event);pause(tout);
3917         tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigEvent',event);pause(tout);
3918         tango_command_inout2('BOO/SY/LOCAL.Bext.1',  'Reset'); % stop les trigs d'extraction boo
3919         tango_write_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigEvent',event);pause(tout);
3920         tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctEvent',event);pause(tout);
3921         tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvEvent',event);pause(tout);
3922         tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'emittanceEvent',event);pause(tout);
3923         tango_command_inout2('ANS-C01/SY/LOCAL.Ainj.1', 'Reset');
3924         arg.svalue={'k1.trig','k2.trig','k3.trig','k4.trig'}; arg.lvalue=int32([3 3 3 3]); 
3925         tango_command_inout('ANS-C01/SY/LOCAL.Ainj.1','SetEventsNumbers',arg);% chagement groupé address sans update
3926         %tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigEvent',event);pause(tout);
3927         %tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigEvent',event);pause(tout);
3928         %tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigEvent',event);pause(tout);
3929         %tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigEvent',event);pause(tout);
3930         %tango_command_inout2('ANS-C01/SY/LOCAL.Ainj.1', 'Reset');
3931         
3932         %arg.svalue={'sep-p','sep-a'}; arg.lvalue=int32([3 3]);
3933         %tango_command_inout('ANS-C01/SY/LOCAL.Ainj.2','SetEventsNumbers',arg);% chagement groupé address sans update
3934         tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigEvent',event);pause(tout);
3935         tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigEvent',event);pause(tout);
3936         tango_command_inout2('ANS-C01/SY/LOCAL.Ainj.2',  'Reset'); % stop les trigs d'injection anneau
3937         tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'dcctEvent',event);pause(tout);
3938         tango_write_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigEvent',event);pause(tout);
3939         tango_write_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3940         tango_write_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3941         tango_write_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3942         tango_write_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3943         tango_write_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3944         tango_write_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3945         tango_write_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3946         tango_write_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);
3947         tango_write_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3948         tango_write_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3949         tango_write_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3950         tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3951         tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3952         tango_write_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3953         tango_write_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigEvent',event);pause(tout);  
3954     
3955     % special modulateur
3956         inj_offset=str2double(get(handles.inj_offset,'String'));
3957         inj=str2double(get(handles.central_inj,'String'));
3958         soft=str2double(get(handles.central_soft,'String'));
3959         temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
3960         delay=inj_offset+0;
3961         tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
3962     % special septum actif boo et ans
3963         r=(1+0.0004);
3964         boo=readattribute('BOO-C12/EP/AL_SEP_A.Ext/voltage'); boo=boo*r;
3965         writeattribute('BOO-C12/EP/AL_SEP_A.Ext/voltage,',boo);
3966         ans=readattribute('ANS-C01/EP/AL_SEP_A/voltage'); ans=ans*r;
3967         writeattribute('ANS-C01/EP/AL_SEP_A/voltage,',ans);     
3968 end
3969 
3970 display('ok change address')
3971 
3972 
3973 
3974 function edit_filling_entrer_bunch1_Callback(hObject, eventdata, handles)
3975 % hObject    handle to edit_filling_entrer_bunch1 (see GCBO)
3976 % eventdata  reserved - to be defined in a future version of MATLAB
3977 % handles    structure with handles and user data (see GUIDATA)
3978 
3979 % Hints: get(hObject,'String') returns contents of edit_filling_entrer_bunch1 as text
3980 %        str2double(get(hObject,'String')) returns contents of edit_filling_entrer_bunch1 as a double
3981 
3982 
3983 
3984 
3985 % --- Executes during object creation, after setting all properties.
3986 function edit_filling_entrer_bunch1_CreateFcn(hObject, eventdata, handles)
3987 % hObject    handle to edit_filling_entrer_bunch1 (see GCBO)
3988 % eventdata  reserved - to be defined in a future version of MATLAB
3989 % handles    empty - handles not created until after all CreateFcns called
3990 
3991 % Hint: edit controls usually have a white background on Windows.
3992 %       See ISPC and COMPUTER.
3993 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3994     set(hObject,'BackgroundColor','white');
3995 end
3996 
3997 
3998 
3999 function edit_Imin_Callback(hObject, eventdata, handles)
4000 % hObject    handle to edit_Imin (see GCBO)
4001 % eventdata  reserved - to be defined in a future version of MATLAB
4002 % handles    structure with handles and user data (see GUIDATA)
4003 
4004 % Hints: get(hObject,'String') returns contents of edit_Imin as text
4005 %        str2double(get(hObject,'String')) returns contents of edit_Imin as a double
4006 
4007 
4008 % --- Executes during object creation, after setting all properties.
4009 function edit_Imin_CreateFcn(hObject, eventdata, handles)
4010 % hObject    handle to edit_Imin (see GCBO)
4011 % eventdata  reserved - to be defined in a future version of MATLAB
4012 % handles    empty - handles not created until after all CreateFcns called
4013 
4014 % Hint: edit controls usually have a white background on Windows.
4015 %       See ISPC and COMPUTER.
4016 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
4017     set(hObject,'BackgroundColor','white');
4018 end
4019 
4020 
4021 % --------------------------------------------------------------------
4022 function uipanel_spm_mode_SelectionChangeFcn(hObject, eventdata, handles)
4023 % hObject    handle to uipanel_spm_mode (see GCBO)
4024 % eventdata  reserved - to be defined in a future version of MATLAB
4025 % handles    structure with handles and user data (see GUIDATA)
4026 
4027 %h=get(handles.uipanel_spm_mode);
4028 %get(h.Children)
4029 
4030 mode=get(get(handles.uipanel_spm_mode,'SelectedObject'),'Tag');
4031 
4032 switch mode  % Get Tag of selected object
4033     case 'spm_mode_1'
4034         display('spm_mode_1')     
4035         tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(1));
4036     case 'spm_mode_2'
4037         display('spm_mode_2')  
4038         tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(2));
4039     case 'spm_mode_2p'
4040         display('spm_mode_2p')   
4041         tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(3));
4042     case 'spm_mode_3'
4043         display('spm_mode_3')    
4044         tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(4));   
4045 end
4046 
4047 
4048 % --------------------------------------------------------------------
4049 function uipanel_lpm_spm_mode_SelectionChangeFcn(hObject, eventdata, handles)
4050 % hObject    handle to uipanel_lpm_spm_mode (see GCBO)
4051 % eventdata  reserved - to be defined in a future version of MATLAB
4052 % handles    structure with handles and user data (see GUIDATA)
4053 
4054 
4055 mode=get(get(handles.uipanel_lpm_spm_mode,'SelectedObject'),'Tag');
4056 modeinj=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
4057 if strcmp(modeinj,'togglebutton_soft')
4058     event16=int16(5);
4059     event32=int32(5);
4060 elseif strcmp(modeinj,'togglebutton_3Hz')
4061     event16=int16(0);
4062     event32=int32(0);
4063 end
4064 
4065 switch mode  % Get Tag of selected object
4066     case 'no_mode'
4067         tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',int32(0)); 
4068         tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',int16(0)); 
4069         
4070     case 'lpm_mode'
4071         tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',event32); 
4072         tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',int16(0));     
4073         
4074         tango_write_attribute('LT1/AE/CV.2', 'current',  0.088 );
4075         tango_write_attribute('LT1/AE/CV.3', 'current', -0.34 );
4076 
4077     case 'spm_mode'
4078         tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',int32(0)); 
4079         tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',event16);   
4080         
4081         tango_write_attribute('LT1/AE/CV.2', 'current',  0.112 );
4082         tango_write_attribute('LT1/AE/CV.3', 'current', -0.077 );
4083         
4084 end
4085 
4086 
4087

Generated on Mon 21-May-2007 15:35:27 by m2html © 2003