1 | function varargout = emittance_v2(varargin) |
---|
2 | % EMITTANCE_V2 M-file for emittance_v2.fig |
---|
3 | % EMITTANCE_V2, by itself, creates a new EMITTANCE_V2 or raises the existing |
---|
4 | % singleton*. |
---|
5 | % |
---|
6 | % H = EMITTANCE_V2 returns the handle to a new EMITTANCE_V2 or the handle to |
---|
7 | % the existing singleton*. |
---|
8 | % |
---|
9 | % EMITTANCE_V2('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
10 | % function named CALLBACK in EMITTANCE_V2.M with the given input arguments. |
---|
11 | % |
---|
12 | % EMITTANCE_V2('Property','Value',...) creates a new EMITTANCE_V2 or raises the |
---|
13 | % existing singleton*. Starting from the left, property value pairs are |
---|
14 | % applied to the GUI before emittance_v2_OpeningFunction gets called. An |
---|
15 | % unrecognized property name or invalid value makes property application |
---|
16 | % stop. All inputs are passed to emittance_v2_OpeningFcn via varargin. |
---|
17 | % |
---|
18 | |
---|
19 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one |
---|
20 | % instance to run (singleton)". |
---|
21 | % |
---|
22 | % See also: GUIDE, GUIDATA, GUIHANDLES |
---|
23 | |
---|
24 | % Edit the above text to modify the response to help emittance_v2 |
---|
25 | |
---|
26 | % Last Modified by GUIDE v2.5 20-May-2005 09:14:01 |
---|
27 | |
---|
28 | % Begin initialization code - DO NOT EDIT |
---|
29 | gui_Singleton = 1; |
---|
30 | gui_State = struct('gui_Name', mfilename, ... |
---|
31 | 'gui_Singleton', gui_Singleton, ... |
---|
32 | 'gui_OpeningFcn', @emittance_v2_OpeningFcn, ... |
---|
33 | 'gui_OutputFcn', @emittance_v2_OutputFcn, ... |
---|
34 | 'gui_LayoutFcn', [] , ... |
---|
35 | 'gui_Callback', []); |
---|
36 | if nargin & isstr(varargin{1}) |
---|
37 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
38 | end |
---|
39 | |
---|
40 | if nargout |
---|
41 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
42 | else |
---|
43 | gui_mainfcn(gui_State, varargin{:}); |
---|
44 | end |
---|
45 | % End initialization code - DO NOT EDIT |
---|
46 | |
---|
47 | % --- Executes just before emittance_v2 is made visible. |
---|
48 | function emittance_v2_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
49 | % This function has no output args, see OutputFcn. |
---|
50 | % hObject handle to figure |
---|
51 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
52 | % handles structure with handles and user data (see GUIDATA) |
---|
53 | % varargin command line arguments to emittance_v2 (see VARARGIN) |
---|
54 | |
---|
55 | % initialisation de l'ACCELERATOR_OBJECT |
---|
56 | %lt2init |
---|
57 | |
---|
58 | % creation nouveau champ |
---|
59 | handles.output = hObject; |
---|
60 | handles.number_errors=0.; |
---|
61 | handles.nbsigmas=0; |
---|
62 | |
---|
63 | %essai |
---|
64 | %handles.nbremove=0; |
---|
65 | handles.nbrestore=0; |
---|
66 | |
---|
67 | val=0; |
---|
68 | faisc=[]; |
---|
69 | st= struct([]); |
---|
70 | cellule=cell(1,1); |
---|
71 | %st2= struct([]);99 |
---|
72 | %st3=struct([]); |
---|
73 | handles.Sauver=struct([]); |
---|
74 | vect_colonne_noire=[]; |
---|
75 | vect_ligne_noire=[]; |
---|
76 | directory_principale=''; |
---|
77 | directory_sauvegarde=''; |
---|
78 | setappdata(handles.figure1,'tailles',faisc); |
---|
79 | setappdata(handles.figure1,'nbenregistrs',2); |
---|
80 | setappdata(handles.figure1,'ResultsData',st); |
---|
81 | setappdata(handles.figure1,'nbenregistremen99ts',st); |
---|
82 | setappdata(handles.figure1,'Sauver',st); |
---|
83 | setappdata(handles.figure1,'Ecran',cellule); |
---|
84 | setappdata(handles.figure1,'largeur_option',val); |
---|
85 | setappdata(handles.figure1,'vect_colonne_noire',vect_colonne_noire); |
---|
86 | setappdata(handles.figure1,'vect_ligne_noire',vect_ligne_noire); |
---|
87 | setappdata(handles.figure1, 'G',0.043); |
---|
88 | % initialisation drapeau pour dialogue 'sauvegarde sur disque' ____ |
---|
89 | setappdata(handles.figure1,'init_sauvegarde',val); |
---|
90 | % directory principale (dï¿œpend de l'utilisateur !!!) |
---|
91 | setappdata(handles.figure1,'directory_principale',directory_principale); |
---|
92 | setappdata(handles.figure1,'directory_sauvegarde',directory_sauvegarde); |
---|
93 | |
---|
94 | handles.nbenregistrs=getappdata(handles.figure1,'nbenregistrs') |
---|
95 | |
---|
96 | % Creates timer Infinite loop |
---|
97 | timer1=timer('StartDelay',1,... |
---|
98 | 'ExecutionMode','fixedRate','Period',.333,'TasksToExecute',Inf); |
---|
99 | timer1.TimerFcn = {@mycallback, hObject,eventdata, handles}; |
---|
100 | setappdata(handles.figure1,'Timer',timer1); |
---|
101 | |
---|
102 | % button group sur l'image en continu |
---|
103 | h = uibuttongroup('visible','off','Position',[0.05 .9 .12 .08],... |
---|
104 | 'Title','Image','TitlePosition','centertop'); |
---|
105 | u1 = uicontrol('Style','Radio','String','ON','Tag','radiobutton1',... |
---|
106 | 'pos',[2 .9 45 30],'parent',h,'HandleVisibility','off'); |
---|
107 | u2 = uicontrol('Style','Radio','String','OFF','Tag','radiobutton2',... |
---|
108 | 'pos',[50 .9 45 30],'parent',h,'HandleVisibility','off'); |
---|
109 | |
---|
110 | % set(h,'SelectionChangeFcn',@selcbk); |
---|
111 | set(h,'SelectionChangeFcn',... |
---|
112 | {@uibuttongroup_SelectionChangeFcn,handles}); |
---|
113 | |
---|
114 | set(h,'SelectedObject',u2); % No selection |
---|
115 | set(h,'Visible','on'); |
---|
116 | |
---|
117 | % positionne par défaut la lentille basse (plus de sensibilité pour les réglages) |
---|
118 | set(handles.Lenthaute_radiobutton7,'Value',0); |
---|
119 | set(handles.tata_radiobutton10,'Value',1); |
---|
120 | |
---|
121 | %% Set closing gui function |
---|
122 | set(handles.figure1,'CloseRequestFcn',{@Closinggui,timer1,handles.figure1}); |
---|
123 | |
---|
124 | |
---|
125 | % Update handles structure |
---|
126 | guidata(hObject, handles); |
---|
127 | |
---|
128 | %%%if strcmp(get(hObject,'Visible'),'off') |
---|
129 | %%% initialize_gui(hObject, handles); |
---|
130 | %%%end |
---|
131 | |
---|
132 | % UIWAIT makes emittance_v2 wait for user response (see UIRESUME) |
---|
133 | % uiwait(handles.figure1); |
---|
134 | |
---|
135 | |
---|
136 | % --- Outputs from this function are returned to the command line. |
---|
137 | function varargout = emittance_v2_OutputFcn(hObject, eventdata, handles) |
---|
138 | % varargout cell array for returning output args (see VARARGOUT); |
---|
139 | % hObject handle to figure |
---|
140 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
141 | % handles structure with handles and user data (see GUIDATA) |
---|
142 | |
---|
143 | % Get default command line output from handles structure |
---|
144 | varargout{1} = handles.output; |
---|
145 | |
---|
146 | |
---|
147 | % % --- Executes during object creation, after setting all properties. |
---|
148 | |
---|
149 | initialize_gui(gcbf, handles); |
---|
150 | |
---|
151 | function initialize_gui(fig_handle, handles) |
---|
152 | |
---|
153 | |
---|
154 | %____________________________________________________________________ |
---|
155 | % dï¿œfinir les alias pour les devices |
---|
156 | device_name.videograbber = 'lt2/dg/emit-vg'; |
---|
157 | device_name.iris = 'lt2/dg/emit-iris'; |
---|
158 | device_name.lentille_haute = 'lt2/dg/emit-l.haut'; |
---|
159 | device_name.lentille_basse = 'lt2/dg/emit-l.bas'; |
---|
160 | device_name.miroir = 'lt2/dg/emit-mc'; |
---|
161 | device_name.backlight = 'lt2/dg/emit-bl'; |
---|
162 | device_name.ecran = 'lt2/dg/emit-ecr'; |
---|
163 | device_name.Q1 = 'lt2/AE/Q.1'; |
---|
164 | device_name.Q2 = 'lt2/AE/Q.2'; |
---|
165 | device_name.Q3 = 'lt2/AE/Q.3'; |
---|
166 | device_name.Q4 = 'lt2/AE/Q.4'; |
---|
167 | device_name.H1 = 'lt2/AE/CH.1'; |
---|
168 | device_name.H2 = 'lt2/AE/CH.2'; |
---|
169 | device_name.V1 = 'lt2/AE/CV.1'; |
---|
170 | setappdata(handles.figure1,'device_name',device_name); |
---|
171 | |
---|
172 | %____________________________________________________________________ |
---|
173 | % directory de sauvegarde en attente |
---|
174 | |
---|
175 | %uibuttongroup |
---|
176 | % prompt={'entrez votre directory de travail'}; |
---|
177 | % name='DIRECTORY PRINCIPALE'; |
---|
178 | % numlines=1; |
---|
179 | % defaultanswer={'/home/PM/tordeux/matlab_test/'}; |
---|
180 | % |
---|
181 | % options.Resize='on'; |
---|
182 | % options.WindowStyle='normal'; |
---|
183 | % options.Interpreter='tex'; |
---|
184 | % nom=inputdlg(prompt,name,numlines,defaultanswer,options); |
---|
185 | % if ~isempty(nom) |
---|
186 | % setappdata(handles.figure1,'directory_principale',nom{:}); |
---|
187 | % end |
---|
188 | % |
---|
189 | % directory_principale=getappdata(handles.figure1,'directory_principale'); |
---|
190 | |
---|
191 | %DirectoryName = '/home/PM/nadolski/controlroom/measdata/lt2data/'; |
---|
192 | directory_principale = getfamilydata('Directory','EMITData'); |
---|
193 | phrase=strcat(directory_principale ,'?'); |
---|
194 | set(handles.directory_sauvegarde_edit28,'String',phrase); |
---|
195 | setappdata(handles.figure1,'directory_principale',directory_principale); |
---|
196 | |
---|
197 | %____________________________________________________________________ |
---|
198 | % inscrire les courants effectifs des aimants de la machine |
---|
199 | |
---|
200 | % valQ1= (read_magnet(device_name.Q1)); |
---|
201 | % set(handles.Q1courant_edit,'String',sprintf('%3.2f',valQ1)); |
---|
202 | % resQ1 = str2double(get(handles.Q1courant_edit,'String')); |
---|
203 | % setappdata(handles.figure1,'Q1courant',resQ1); |
---|
204 | % |
---|
205 | % valQ2= (read_magnet(device_name.Q2)); |
---|
206 | % set(handles.Q2courant_edit,'String',sprintf('%3.2f',valQ2)); |
---|
207 | % resQ2 = str2double(get(handles.Q2courant_edit,'String')); |
---|
208 | % setappdata(handles.figure1,'Q2courant',resQ2); |
---|
209 | % |
---|
210 | % valQ3= (read_magnet(device_name.Q3)); |
---|
211 | % set(handles.Q3courant_edit,'String',sprintf('%3.2f',valQ3)); |
---|
212 | % resQ3 = str2double(get(handles.Q3courant_edit,'String')); |
---|
213 | % setappdata(handles.figure1,'Q3courant',resQ3); |
---|
214 | % |
---|
215 | % valQ4= (read_magnet(device_name.Q4)); |
---|
216 | % set(handles.Q4courant_edit,'String',sprintf('%3.2f',valQ4)); |
---|
217 | % resQ4 = str2double(get(handles.Q4courant_edit,'String')); |
---|
218 | % setappdata(handles.figure1,'Q4courant',resQ4); |
---|
219 | % |
---|
220 | % valH1= (read_magnet(device_name.H1)); |
---|
221 | % set(handles.H1courant_edit,'String',sprintf('%3.2f',valH1)); |
---|
222 | % resH1 = str2double(get(handles.H1courant_edit,'String')); |
---|
223 | % setappdata(handles.figure1,'H1courant',resH1); |
---|
224 | % |
---|
225 | % valH2= (read_magnet(device_name.H2)); |
---|
226 | % set(handles.H2courant_edit,'String',sprintf('%3.2f',valH2)); |
---|
227 | % resH2 = str2double(get(handles.H2courant_edit,'String')); |
---|
228 | % setappdata(handles.figure1,'H2courant',resH2); |
---|
229 | % |
---|
230 | % valV1= (read_magnet(device_name.V1)); |
---|
231 | % set(handles.V1courant_edit,'String',sprintf('%3.2f',valV1)); |
---|
232 | % resV1 = str2double(get(handles.V1courant_edit,'String')); |
---|
233 | % setappdata(handles.figure1,'V1courant',resV1); |
---|
234 | |
---|
235 | %____________________________________________________________________ |
---|
236 | % insrire une valeur par dï¿œfaut de calibration ??? |
---|
237 | set(handles.G_edit12,'String',num2str(43)); |
---|
238 | clear('figh'); |
---|
239 | |
---|
240 | %____________________________________________________________________ |
---|
241 | % mettre off le bouton calibration de l'image |
---|
242 | set([handles.calibOFF_radiobutton6],'Value',1); |
---|
243 | |
---|
244 | %____________________________________________________________________ |
---|
245 | % exclure la possibilitᅵ de calibrer et de bouger les lentilles |
---|
246 | set([handles.Lenthaute_radiobutton7,handles.tata_radiobutton10,... |
---|
247 | handles.ppp_pushbutton18,handles.pp_pushbutton19,handles.p_pushbutton20... |
---|
248 | handles.mmm_pushbutton21,handles.mm_pushbutton22,handles.m_pushbutton23... |
---|
249 | ,handles.backlight_popupmenu3,... |
---|
250 | handles.Gmax_pushbutton26,handles.Gmoy_pushbutton27,handles.Gmin_pushbutton28,... |
---|
251 | handles.qualite_edit23,handles.G_edit12,... |
---|
252 | handles.pos1_edit29,handles.pos2_edit30... |
---|
253 | handles.text45,handles.text39,handles.text26,handles.text41... |
---|
254 | handles.calib_pushbutton7],'Enable','off') |
---|
255 | % handles.backlight_pushbutton24,handles.iris_pushbutton25,... |
---|
256 | |
---|
257 | %____________________________________________________________________ |
---|
258 | % positionner le miroir HORS, eteindre le backlight |
---|
259 | % tango_command_inout('lt2/emit/mirror','Off'); |
---|
260 | % tango_command_inout('lt2/emit/backlight','SetBrightness',uint16(0)); |
---|
261 | % miroir LT2 : dï¿œfaut cï¿œblage. Provisoirement on ï¿œchange commande dans |
---|
262 | % MATLAB et non pas dans le DServer |
---|
263 | %tango_command_inout(device_name.miroir,'Off'); |
---|
264 | tango_command_inout(device_name.miroir,'On'); |
---|
265 | tango_command_inout(device_name.backlight,'SetBrightness',uint16(0)); |
---|
266 | %___________________________________________________________________ |
---|
267 | % position des lentilles pour les differents grandissements, en nombre de pas |
---|
268 | setappdata(handles.figure1,'posl1Gmax',3000); |
---|
269 | setappdata(handles.figure1,'posl2Gmax',34600); |
---|
270 | setappdata(handles.figure1,'posl1Gmoy',8000); |
---|
271 | setappdata(handles.figure1,'posl2Gmoy',19500); |
---|
272 | setappdata(handles.figure1,'posl1Gmin',0); |
---|
273 | setappdata(handles.figure1,'posl2Gmin',3046); |
---|
274 | |
---|
275 | %____________________________________________________________________ |
---|
276 | % positionner les voyants des butᅵes lentilles ᅵ leur valeur vraies |
---|
277 | |
---|
278 | %dev=device_name.lentille_haute; |
---|
279 | dev=device_name.lentille_haute; |
---|
280 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
281 | |
---|
282 | |
---|
283 | % errorstatus=21 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
284 | % errorstatus=3 limitswitch forward |
---|
285 | % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens - |
---|
286 | % errorstatus=4 limitswitch backward |
---|
287 | |
---|
288 | if (tango_error == -1) |
---|
289 | %- handle error |
---|
290 | tango_print_error_stack; |
---|
291 | return; |
---|
292 | errordlg('erreur tango !','Erreur'); |
---|
293 | |
---|
294 | else |
---|
295 | % cas ou l'axe est en butee backward (en haut) |
---|
296 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
297 | set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
298 | end |
---|
299 | % cas ou l'axe est en butee forward (en bas) |
---|
300 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
301 | set(handles.LHBB_edit24,'BackgroundColor','red'); |
---|
302 | end |
---|
303 | |
---|
304 | end |
---|
305 | |
---|
306 | |
---|
307 | dev=device_name.lentille_basse |
---|
308 | |
---|
309 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
310 | |
---|
311 | if (tango_error == -1) |
---|
312 | %- handle error |
---|
313 | tango_print_error_stack; |
---|
314 | return; |
---|
315 | errordlg('erreur tango !','Erreur'); |
---|
316 | |
---|
317 | else |
---|
318 | % cas ou l'axe est en butee backward (en haut) |
---|
319 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
320 | set(handles.LBBH_edit26,'BackgroundColor','red'); |
---|
321 | end |
---|
322 | % cas ou l'axe est en butee forward (en bas) |
---|
323 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
324 | set(handles.LBBB_edit27,'BackgroundColor','red'); |
---|
325 | end |
---|
326 | end |
---|
327 | |
---|
328 | |
---|
329 | %____________________________________________________________________ |
---|
330 | % allumer en rouge le grandissement effectif |
---|
331 | |
---|
332 | posl1Gmax=getappdata(handles.figure1,'posl1Gmax'); |
---|
333 | posl2Gmax=getappdata(handles.figure1,'posl2Gmax'); |
---|
334 | posl1Gmoy=getappdata(handles.figure1,'posl1Gmoy'); |
---|
335 | posl2Gmoy=getappdata(handles.figure1,'posl2Gmoy'); |
---|
336 | posl1Gmin=getappdata(handles.figure1,'posl1Gmin'); |
---|
337 | posl2Gmin=getappdata(handles.figure1,'posl2Gmin'); |
---|
338 | |
---|
339 | |
---|
340 | dev1=device_name.lentille_haute; |
---|
341 | dev2=device_name.lentille_basse; |
---|
342 | |
---|
343 | str1=tango_read_attribute(dev1,'AxisCurrentPosition'); |
---|
344 | str2=tango_read_attribute(dev2,'AxisCurrentPosition'); |
---|
345 | position1=str1.value(1); |
---|
346 | position2=str2.value(1); |
---|
347 | |
---|
348 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
349 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
350 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
351 | |
---|
352 | if (tango_error == -1) |
---|
353 | %- handle error |
---|
354 | tango_print_error_stack; |
---|
355 | return; |
---|
356 | errordlg('erreur tango !','Erreur'); |
---|
357 | |
---|
358 | else |
---|
359 | % cas du grandissement max |
---|
360 | if isequal(position1,posl1Gmax)&isequal(position2,posl2Gmax) |
---|
361 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
362 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
363 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
364 | end |
---|
365 | % cas du grandissement moyen |
---|
366 | if isequal(position1,posl1Gmoy)&isequal(position2,posl2Gmoy) |
---|
367 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
368 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
369 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
370 | end |
---|
371 | % cas du grandissement min |
---|
372 | if isequal(position1,posl1Gmin)&isequal(position2,posl2Gmin) |
---|
373 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
374 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
375 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
376 | end |
---|
377 | |
---|
378 | end |
---|
379 | |
---|
380 | %________________________________________________________________________ |
---|
381 | % ï¿œcrire les valeurs effectives de positions des lentilles |
---|
382 | |
---|
383 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
384 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
385 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
386 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
387 | |
---|
388 | |
---|
389 | %set(handles.nbacqu_edit13,'String',num2str(handles.nbenregistrs)); |
---|
390 | %set(handles.nbacqu_edit13,'String',num2str(handles.nbenregistrs)); |
---|
391 | |
---|
392 | % --- Executes during object creation, after setting all properties. |
---|
393 | function lent1_slider1_CreateFcn(hObject, eventdata, handles) |
---|
394 | % hObject handle to lent1_slider1 (see GCBO) |
---|
395 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
396 | % handles empty - handles not created until after all CreateFcns called |
---|
397 | |
---|
398 | % Hint: slider controls usually have a light gray background, change |
---|
399 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
400 | usewhitebg = 1; |
---|
401 | if usewhitebg |
---|
402 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
403 | else |
---|
404 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
405 | end |
---|
406 | |
---|
407 | % du temps ou il y avait des sliders.... |
---|
408 | % % --- Executes on slider movement. |
---|
409 | % function lent1_slider1_Callback(hObject, eventdata, handles) |
---|
410 | % % hObject handle to lent1_slider1 (see GCBO) |
---|
411 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
412 | % % handles structure with handles and user data (see GUIDATA) |
---|
413 | % |
---|
414 | % % Hints: get(hObject,'Value') returns position of slider |
---|
415 | % % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
416 | % |
---|
417 | % set(handles.lent1_edit5,'String',... |
---|
418 | % num2str(get(handles.lent1_slider1,'Value'))); |
---|
419 | % |
---|
420 | % % --- Executes during object creation, after setting all properties. |
---|
421 | % function lent1_edit5_CreateFcn(hObject, eventdata, handles) |
---|
422 | % % hObject handle to lent1_edit5 (see GCBO) |
---|
423 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
424 | % % handles empty - handles not created until after all CreateFcns called |
---|
425 | % |
---|
426 | % % Hint: edit controls usually have a white background on Windows. |
---|
427 | % % See ISPC and COMPUTER. |
---|
428 | % if ispc |
---|
429 | % set(hObject,'BackgroundColor','white'); |
---|
430 | % else |
---|
431 | % set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
432 | % end |
---|
433 | |
---|
434 | |
---|
435 | % function lent1_edit5_Callback(hObject, eventdata, handles) |
---|
436 | % % hObject handle to lent1_edit5 (see GCBO) |
---|
437 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
438 | % % handles structure with handles and user data (see GUIDATA) |
---|
439 | % |
---|
440 | % % Hints: get(hObject,'String') returns contents of lent1_edit5 as text |
---|
441 | % % str2double(get(hObject,'String')) returns contents of lent1_edit5 as a double |
---|
442 | % |
---|
443 | % |
---|
444 | % val = str2double(get(handles.lent1_edit5,'String')); |
---|
445 | % % Determine whether val is a number between 0 and 1 |
---|
446 | % if isnumeric(val) & length(val)==1 & ... |
---|
447 | % val >= get(handles.lent1_slider1,'Min') & ... |
---|
448 | % val <= get(handles.lent1_slider1,'Max') |
---|
449 | % set(handles.lent1_slider1,'Value',val); |
---|
450 | % else |
---|
451 | % % Increment the error count, and display it |
---|
452 | % handles.number_errors = handles.number_errors+1; |
---|
453 | % guidata(hObject,handles); % store the changes |
---|
454 | % set(handles.lent1_edit5,'String',... |
---|
455 | % ['Caramba ',... |
---|
456 | % %num2str(handles.number_errors),' Times']); |
---|
457 | % '']); |
---|
458 | % end |
---|
459 | % |
---|
460 | % |
---|
461 | % % --- Executes during object creation, after setting all properties. |
---|
462 | % function lent2_slider2_CreateFcn(hObject, eventdata, handles) |
---|
463 | % % hObject handle to lent2_slider2 (see GCBO) |
---|
464 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
465 | % % handles empty - handles not created until after all CreateFcns called |
---|
466 | % |
---|
467 | % % Hint: slider controls usually have a light gray background, change |
---|
468 | % % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
469 | % usewhitebg = 1; |
---|
470 | % if usewhitebg |
---|
471 | % set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
472 | % else |
---|
473 | % set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
474 | % end |
---|
475 | % |
---|
476 | % |
---|
477 | % % --- Executes on slider movement. |
---|
478 | % function lent2_slider2_Callback(hObject, eventdata, handles) |
---|
479 | % % hObject handle to lent2_slider2 (see GCBO) |
---|
480 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
481 | % % handles structure with handles and user data (see GUIDATA) |
---|
482 | % |
---|
483 | % % Hints: get(hObject,'Value') returns position of slider |
---|
484 | % % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
485 | % |
---|
486 | % set(handles.lent2_emitV_edit19,'String',... |
---|
487 | % num2str(get(handles.lent2_slider2,'Value'))); |
---|
488 | % |
---|
489 | % % --- Executes during object creation, after setting all properties. |
---|
490 | % function lent2_emitV_edit19_CreateFcn(hObject, eventdata, handles) |
---|
491 | % % hObject handle to lent2_emitV_edit19 (see GCBO) |
---|
492 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
493 | % % handles empty - handles not created until after all CreateFcns called |
---|
494 | % |
---|
495 | % % Hint: edit controls usually have a white background on Windows. |
---|
496 | % % See ISPC and COMPUTER. |
---|
497 | % if ispc |
---|
498 | % set(hObject,'BackgroundColor','white'); |
---|
499 | % else |
---|
500 | % set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
501 | % end |
---|
502 | % |
---|
503 | % |
---|
504 | % |
---|
505 | % function lent2_emitV_edit19_Callback(hObject, eventdata, handles) |
---|
506 | % % hObject handle to lent2_emitV_edit19 (see GCBO) |
---|
507 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
508 | % % handles structure with handles and user data (see GUIDATA) |
---|
509 | % |
---|
510 | % % Hints: get(hObject,'String') returns contents of lent2_emitV_edit19 as text |
---|
511 | % % str2double(get(hObject,'String')) returns contents of lent2_emitV_edit19 as a double |
---|
512 | % |
---|
513 | % val = str2double(get(handles.lent2_emitV_edit19,'String')); |
---|
514 | % % Determine whether val is a number between 0 and 1 |
---|
515 | % if isnumeric(val) & length(val)==1 & ... |
---|
516 | % val >= get(handles.lent2_slider2,'Min') & ... |
---|
517 | % val <= get(handles.lent2_slider2,'Max') |
---|
518 | % set(handles.lent2_slider2,'Value',val); |
---|
519 | % else |
---|
520 | % % Increment the error count, and display it |
---|
521 | % handles.number_errors = handles.number_errors+1; |
---|
522 | % guidata(hObject,handles); % store the changes |
---|
523 | % set(handles.lent2_emitV_edit19,'String',... |
---|
524 | % ['Zut ',... |
---|
525 | % %num2str(handles.number_errors),'']); |
---|
526 | % '']); |
---|
527 | % end |
---|
528 | |
---|
529 | % --- Executes on button press in calib_pushbutton7. |
---|
530 | function calib_pushbutton7_Callback(hObject, eventdata, handles) |
---|
531 | % hObject handle to calib_pushbutton7 (see GCBO) |
---|
532 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
533 | % handles structure with handles and user data (see GUIDATA) |
---|
534 | |
---|
535 | |
---|
536 | % alias |
---|
537 | device_name=getappdata(handles.figure1,'device_name'); |
---|
538 | dev=device_name.videograbber; |
---|
539 | |
---|
540 | % % % |
---|
541 | tango_command_inout(dev,'Calibrate'); |
---|
542 | %ATTENTION PEUT ETRE ATTRIBUTS AVEC un SSSSS |
---|
543 | if isequal(tango_error,-1) |
---|
544 | |
---|
545 | %errordlg('erreur TANGO...','Error'); |
---|
546 | tango_print_error_stack; |
---|
547 | diag = tango_error_stack; |
---|
548 | errordlg(diag(1).desc); |
---|
549 | else |
---|
550 | |
---|
551 | res=tango_read_attribute(dev,'calibration_quality'); |
---|
552 | % on teste la qualitᅵ de la calibration FACTEUR 996.0 |
---|
553 | % le 10 septembre MATLAB a pris lamain sur le code de NL pour le |
---|
554 | % critᅵre. attention ᅵ 990 on est dans les choux |
---|
555 | if res.value>996.0 |
---|
556 | val=sprintf('%3.2f',res.value); |
---|
557 | set(handles.qualite_edit23,'String',val); |
---|
558 | tango_read_attribute(dev,'x_magnification_factor'); |
---|
559 | val=sprintf('%2.1f',1000*ans.value); |
---|
560 | % % % |
---|
561 | |
---|
562 | % % % % on inscrit en dur le grandissement |
---|
563 | % % % %toto = 14.4 |
---|
564 | % toto = 38. |
---|
565 | % val=sprintf('%2.1f',toto) |
---|
566 | |
---|
567 | set(handles.G_edit12,'String',val); |
---|
568 | setappdata(handles.figure1, 'G',str2num(val)/1000) |
---|
569 | |
---|
570 | %dev='lt2/dg/emit-vg'; |
---|
571 | pause(1); |
---|
572 | toto=tango_read_attribute(dev,'corrected_image'); |
---|
573 | figure(2); |
---|
574 | imagesc(toto.value); |
---|
575 | colormap(gray); |
---|
576 | |
---|
577 | else |
---|
578 | errordlg('la calibration a echouï¿œe ...','Error'); |
---|
579 | end |
---|
580 | |
---|
581 | end |
---|
582 | |
---|
583 | |
---|
584 | |
---|
585 | |
---|
586 | % --- Executes during object creation, after setting all properties. |
---|
587 | function fit_popupmenu1_CreateFcn(hObject, eventdata, handles) |
---|
588 | % hObject handle to fit_popupmenu1 (see GCBO) |
---|
589 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
590 | % handles empty - handles not created until after all CreateFcns called |
---|
591 | |
---|
592 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
593 | % See ISPC and COMPUTER. |
---|
594 | if ispc |
---|
595 | set(hObject,'BackgroundColor','white'); |
---|
596 | else |
---|
597 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
598 | end |
---|
599 | |
---|
600 | |
---|
601 | % --- Executes on selection change in fit_popupmenu1. |
---|
602 | function fit_popupmenu1_Callback(hObject, eventdata, handles) |
---|
603 | % hObject handle to fit_popupmenu1 (see GCBO) |
---|
604 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
605 | % handles structure with handles and user data (see GUIDATA) |
---|
606 | |
---|
607 | % Hints: contents = get(hObject,'String') returns fit_popupmenu1 contents as cell array |
---|
608 | % contents{get(hObject,'Value')} returns selected item from fit_popupmenu1 |
---|
609 | |
---|
610 | val = get(hObject,'Value'); |
---|
611 | switch val |
---|
612 | case 1 |
---|
613 | largeur_option=0; |
---|
614 | case 2 |
---|
615 | % fit par gaussienne |
---|
616 | largeur_option=1; |
---|
617 | |
---|
618 | case 3 |
---|
619 | % vrai rms |
---|
620 | largeur_option=2; |
---|
621 | |
---|
622 | case 4 |
---|
623 | % rayon ᅵ X % |
---|
624 | largeur_option=3; |
---|
625 | end |
---|
626 | setappdata(handles.figure1,'largeur_option',largeur_option); |
---|
627 | |
---|
628 | % --- Executes on button press in mesure_pushbutton8. |
---|
629 | function mesure_pushbutton8_Callback(hObject, eventdata, handles) |
---|
630 | % hObject handle to mesure_pushbutton8 (see GCBO) |
---|
631 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
632 | % handles structure with handles and user data (see GUIDATA) |
---|
633 | |
---|
634 | %nbiterations=0; |
---|
635 | %nombre1=get(handles.fit_popupmenu1, 'String'); |
---|
636 | |
---|
637 | popup_sel_index = get(handles.nbiter_popupmenu2, 'Value'); |
---|
638 | nombre2=get(handles.nbiter_popupmenu2, 'String'); |
---|
639 | Name = nombre2{popup_sel_index}; |
---|
640 | nbiterat=str2num(Name(1)); |
---|
641 | setappdata(handles.figure1, 'nbiterations',nbiterat); |
---|
642 | set(handles.nbiter_edit37,'String',Name(1)); |
---|
643 | switch popup_sel_index |
---|
644 | case 1 |
---|
645 | errordlg('selectionnez un nombre d''iterations','Error'); |
---|
646 | %error('Select a number of acquisitions'); %exprimez votre choix |
---|
647 | case 2 |
---|
648 | %test de la pause : pause(10); |
---|
649 | show1imagesgui_15(handles); |
---|
650 | |
---|
651 | case 3 |
---|
652 | show5imagesgui_15(handles); |
---|
653 | case 4 |
---|
654 | show10imagesgui(handles); |
---|
655 | |
---|
656 | end |
---|
657 | |
---|
658 | |
---|
659 | % --- Executes on button press in plot_pushbutton. |
---|
660 | function plot_pushbutton_Callback(hObject, eventdata, handles) |
---|
661 | % hObject handle to plot_pushbutton (see GCBO) |
---|
662 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
663 | % handles structure with handles and user data (see GUIDATA) |
---|
664 | |
---|
665 | handles.ResultsData=getappdata(handles.figure1,'ResultsData'); |
---|
666 | handles.matrx=[]; |
---|
667 | handles.matry=[]; |
---|
668 | for ik=1:length(handles.ResultsData) |
---|
669 | handles.matrx(ik,1)=handles.ResultsData(ik).Q4courant; |
---|
670 | handles.matrx(ik,2)=handles.ResultsData(ik).LargeurH; |
---|
671 | errorx(ik)=2*handles.ResultsData(ik).sigmaH; |
---|
672 | handles.matry(ik,1)=handles.ResultsData(ik).Q4courant; |
---|
673 | handles.matry(ik,2)=handles.ResultsData(ik).LargeurV; |
---|
674 | errory(ik)=2*handles.ResultsData(ik).sigmaV; |
---|
675 | end |
---|
676 | |
---|
677 | clear('figure3'); |
---|
678 | figure(3); |
---|
679 | tx1=handles.matrx(:,1) |
---|
680 | tx2=handles.matrx(:,2).*handles.matrx(:,2) |
---|
681 | |
---|
682 | ty1=handles.matry(:,1) |
---|
683 | ty2=handles.matry(:,2).*handles.matry(:,2) |
---|
684 | |
---|
685 | %plot(handles.matrx(:,1),handles.matrx(:,2),'d') |
---|
686 | %%plot(handles.matry(:,1),handles.matry(:,2),'d') |
---|
687 | % %'--rs','LineWidth',2,... |
---|
688 | % % 'MarkerEdgeColor','k',... |
---|
689 | % % 'MarkerFaceColor','g',... |
---|
690 | % % 'MarkerSize',8) |
---|
691 | % |
---|
692 | % |
---|
693 | % %%t=[4.298 3.5 3.9 4.6 5.1 5.6 6.2]'; |
---|
694 | % %%y=[2.3 13.5 7. 0.85 1.8 6.3 22.]'; |
---|
695 | % %plot(t,y,'+'),grid on |
---|
696 | % % X = [ones(size(handles.matrx(:,1))) handles.matrx(:,1) handles.matrx(:,1).^2]; |
---|
697 | % % a=X\handles.matrx(:,2); |
---|
698 | % % Tmin=min(handles.matrx(:,1)); |
---|
699 | % % Tmax=max(handles.matrx(:,1)); |
---|
700 | % % T=[Tmin:0.1:Tmax]'; |
---|
701 | % % Z = [ones(size(T)) T T.^2]*a; |
---|
702 | % % hold on |
---|
703 | % % plot(T,Z,'r-',handles.matrx(:,1),handles.matrx(:,2),'ro'), grid on |
---|
704 | % % |
---|
705 | % % |
---|
706 | % % Y = [ones(size(handles.matry(:,1))) handles.matry(:,1) handles.matry(:,1).^2]; |
---|
707 | % % a=Y\handles.matry(:,2); |
---|
708 | % % Tmin=min(handles.matry(:,1)); |
---|
709 | % % Tmax=max(handles.matry(:,1)); |
---|
710 | % % T=[Tmin:0.1:Tmax]'; |
---|
711 | % % Z = [ones(size(T)) T T.^2]*a; |
---|
712 | % % hold on |
---|
713 | % % plot(T,Z,'b-',handles.matry(:,1),handles.matry(:,2),'b+'), grid on |
---|
714 | |
---|
715 | |
---|
716 | %test |
---|
717 | X = [ones(size(tx1)) tx1 tx1.^2]; |
---|
718 | a=X\tx2; |
---|
719 | Tmin=min(tx1); |
---|
720 | Tmax=max(tx1); |
---|
721 | T=[Tmin:0.1:Tmax]'; |
---|
722 | Z = [ones(size(T)) T T.^2]*a; |
---|
723 | hold on |
---|
724 | %plot(T,Z,'r-',tx1,tx2,'ro'), grid on |
---|
725 | plot(tx1,tx2,'ro',T,Z,'r-'), grid on |
---|
726 | |
---|
727 | Y = [ones(size(ty1)) ty1 ty1.^2]; |
---|
728 | a=Y\ty2; |
---|
729 | Tmin=min(ty1); |
---|
730 | Tmax=max(ty1); |
---|
731 | T=[Tmin:0.1:Tmax]'; |
---|
732 | Z = [ones(size(T)) T T.^2]*a; |
---|
733 | hold on |
---|
734 | %plot(T,Z,'b-',ty1,ty2,'b+'), grid on |
---|
735 | plot(ty1,ty2,'b+',T,Z,'b-'), grid on |
---|
736 | |
---|
737 | |
---|
738 | |
---|
739 | % exemple de label des axes avec symboles grecs : |
---|
740 | %xlabel('-\pi \leq \Theta \leq \pi') |
---|
741 | %ylabel('sin(\Theta)') |
---|
742 | %title('Plot of sin(\Theta)') |
---|
743 | %text(-pi/4,sin(-pi/4),'\leftarrow sin(-\pi\div4)',... |
---|
744 | % 'HorizontalAlignment','left') |
---|
745 | |
---|
746 | % nos labels |
---|
747 | xlabel('Courant quadrupolaire (A)') |
---|
748 | ylabel('Largeur faisceau (mm2)') |
---|
749 | legend('Mesures Horizontales','Fit Horizontal','Mesures verticales','Fit vertical','Location','North') |
---|
750 | title('Courbe de focalisation') |
---|
751 | |
---|
752 | % Q1courant de 1 ᅵ 10 A |
---|
753 | %T=[1:0.1:10]'; |
---|
754 | %Y = [ones(size(T)) T T.^2]*a; |
---|
755 | %%figure(1); |
---|
756 | %hold on |
---|
757 | %figure(4) |
---|
758 | %plot(T,Y,'-',handles.matrx(:,1),handles.matrx(:,2),'o'), grid on |
---|
759 | %hold on |
---|
760 | |
---|
761 | % barre d'erreur |
---|
762 | % hold on |
---|
763 | % errorbar(handles.matrx(:,1),handles.matrx(:,2),errorx) |
---|
764 | |
---|
765 | |
---|
766 | % --- Executes during object creation, after setting all properties. |
---|
767 | function Q1courant_edit_CreateFcn(hObject, eventdata, handles) |
---|
768 | % hObject handle to Q1courant_edit (see GCBO) |
---|
769 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
770 | % handles empty - handles not created until after all CreateFcns called |
---|
771 | |
---|
772 | % Hint: edit controls usually have a white background on Windows. |
---|
773 | % See ISPC and COMPUTER. |
---|
774 | if ispc |
---|
775 | set(hObject,'BackgroundColor','white'); |
---|
776 | else |
---|
777 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
778 | end |
---|
779 | |
---|
780 | |
---|
781 | |
---|
782 | function Q1courant_edit_Callback(hObject, eventdata, handles) |
---|
783 | % hObject handle to Q1courant_edit (see GCBO) |
---|
784 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
785 | % handles structure with handles and user data (see GUIDATA) |
---|
786 | |
---|
787 | % Hints: get(hObject,'String') returns contents of Q1courant_edit as text |
---|
788 | % str2double(get(hObject,'String')) returns contents of Q1courant_edit as a double |
---|
789 | |
---|
790 | |
---|
791 | ecriture('Q1',handles) |
---|
792 | |
---|
793 | |
---|
794 | |
---|
795 | function ecriture(aimant,handles) |
---|
796 | |
---|
797 | device_name = getappdata(handles.figure1,'device_name'); |
---|
798 | Name = strcat(aimant,'courant_edit'); |
---|
799 | res = str2double(get(handles.(Name),'String')); |
---|
800 | valmax=tango_get_attribute_config(device_name.(aimant),'current'); |
---|
801 | |
---|
802 | % if res > str2double(valmax.max_value) |
---|
803 | % set(handles.(Name),'BackgroundColor','red'); |
---|
804 | % errordlg('Courant superieur ᅵ valeur maximale !','ALARME'); |
---|
805 | % guidata(gcbo,handles); |
---|
806 | % old = tango_read_attribute(device_name.(aimant),'current'); |
---|
807 | % set(handles.(Name),'String',num2str(old.value(1))); |
---|
808 | % pause(2); |
---|
809 | % set(handles.(Name),'BackgroundColor','green'); |
---|
810 | % else |
---|
811 | set(handles.(Name),'BackgroundColor','green'); |
---|
812 | Name2 =[aimant 'courant']; |
---|
813 | setappdata(handles.figure1,Name2,res); |
---|
814 | tango_write_attribute(device_name.(aimant),'currentPM',res); |
---|
815 | % end |
---|
816 | |
---|
817 | |
---|
818 | % --- Executes during object creation, after setting all properties. |
---|
819 | function H1courant_edit_CreateFcn(hObject, eventdata, handles) |
---|
820 | % hObject handle to H1courant_edit (see GCBO) |
---|
821 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
822 | % handles empty - handles not created until after all CreateFcns called |
---|
823 | |
---|
824 | % Hint: edit controls usually have a white background on Windows. |
---|
825 | % See ISPC and COMPUTER. |
---|
826 | if ispc |
---|
827 | set(hObject,'BackgroundColor','white'); |
---|
828 | else |
---|
829 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
830 | end |
---|
831 | |
---|
832 | function H1courant_edit_Callback(hObject, eventdata, handles) |
---|
833 | % hObject handle to H1courant_edit (see GCBO) |
---|
834 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
835 | % handles structure with handles and user data (see GUIDATA) |
---|
836 | |
---|
837 | % Hints: get(hObject,'String') returns contents of H1courant_edit as text |
---|
838 | % str2double(get(hObject,'String')) returns contents of H1courant_edit as a double |
---|
839 | |
---|
840 | ecriture('H1',handles) |
---|
841 | |
---|
842 | |
---|
843 | |
---|
844 | % --- Executes during object creation, after setting all properties. |
---|
845 | function V1courant_edit_CreateFcn(hObject, eventdata, handles) |
---|
846 | % hObject handle to V1courant_edit (see GCBO) |
---|
847 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
848 | % handles empty - handles not created until after all CreateFcns called |
---|
849 | |
---|
850 | |
---|
851 | % -------------------------------------------------------------------- |
---|
852 | function V1courant_edit_Callback(hObject, eventdata, handles) |
---|
853 | % hObject handle to V1courant_edit (see GCBO) |
---|
854 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
855 | % handles structure with handles and user data (see GUIDATA) |
---|
856 | |
---|
857 | ecriture('V1',handles) |
---|
858 | |
---|
859 | |
---|
860 | % ------- lecture de valeurs dans les devices servers Tango ---------- |
---|
861 | function Cour=read_magnet(dev) |
---|
862 | |
---|
863 | attr_val = tango_read_attribute(dev,'current'); |
---|
864 | if (tango_error == -1) |
---|
865 | %- handle error |
---|
866 | tango_print_error_stack; |
---|
867 | fprintf(1,'TracyServer Error %s\n',dev) |
---|
868 | return; |
---|
869 | end |
---|
870 | Cour=attr_val.value(1); |
---|
871 | |
---|
872 | % -------------------------------------------------------------------- |
---|
873 | % --- Executes during object creation, after setting all properties. |
---|
874 | function nbiter_popupmenu2_CreateFcn(hObject, eventdata, handles) |
---|
875 | % hObject handle to nbiter_popupmenu2 (see GCBO) |
---|
876 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
877 | % handles empty - handles not created until after all CreateFcns called |
---|
878 | |
---|
879 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
880 | % See ISPC and COMPUTER. |
---|
881 | if ispc |
---|
882 | set(hObject,'BackgroundColor','white'); |
---|
883 | else |
---|
884 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
885 | end |
---|
886 | |
---|
887 | set(hObject, 'String', {'Nbre iterations par acquisition','1 iteration par acquisition'... |
---|
888 | ,'5 iterations par acquisition'... |
---|
889 | }); |
---|
890 | |
---|
891 | % --- Executes on selection change in nbiter_popupmenu2. |
---|
892 | function nbiter_popupmenu2_Callback(hObject, eventdata, handles) |
---|
893 | % hObject handle to nbiter_popupmenu2 (see GCBO) |
---|
894 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
895 | % handles structure with handles and user data (see GUIDATA) |
---|
896 | |
---|
897 | % Hints: contents = get(hObject,'String') returns nbiter_popupmenu2 contents as cell array |
---|
898 | % contents{get(hObject,'Value')} returns selected item from nbiter_popupmenu2 |
---|
899 | |
---|
900 | |
---|
901 | % % --- Executes on button press in camera_control_togglebutton. |
---|
902 | % function camera_control_togglebutton_Callback(hObject, eventdata, handles) |
---|
903 | % % hObject handle to camera_control_togglebutton (see GCBO) |
---|
904 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
905 | % % handles structure with handles and user data (see GUIDATA) |
---|
906 | % |
---|
907 | % % Hint: get(hObject,'Value') returns toggle state of camera_control_togglebutton |
---|
908 | % button_state = get(hObject,'Value'); |
---|
909 | % if button_state == get(hObject,'Max') |
---|
910 | % % toggle button is pressed |
---|
911 | % elseif button_state == get(hObject,'Min') |
---|
912 | % % toggle button is not pressed |
---|
913 | % end |
---|
914 | |
---|
915 | |
---|
916 | % ᅵ dᅵtruire |
---|
917 | % % --- Executes on button press in camera_image_togglebutton. |
---|
918 | % function camera_image_togglebutton_Callback(hObject, eventdata, handles) |
---|
919 | % % hObject handle to camera_image_togglebutton (see GCBO) |
---|
920 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
921 | % % handles structure with handles and user data (see GUIDATA) |
---|
922 | % |
---|
923 | % % Hint: get(hObject,'Value') returns toggle state of camera_image_togglebutton |
---|
924 | % button_state = get(hObject,'Value'); |
---|
925 | % if button_state == get(hObject,'Max') |
---|
926 | % % toggle button is pressed |
---|
927 | % elseif button_state == get(hObject,'Min') |
---|
928 | % % toggle button is not pressed |
---|
929 | % end |
---|
930 | % |
---|
931 | % %camera_image(handles); |
---|
932 | % |
---|
933 | % |
---|
934 | % % name=['axes' num2str(1)]; |
---|
935 | % % axes(handles.(name)) |
---|
936 | % % timer1 = timer('Period', 2,'TasksToExecute', |
---|
937 | % % Inf,'ExecutionMode','fixedRate'); |
---|
938 | % |
---|
939 | % % t=timer('StartDelay',1,'TimerFcn',@mycallback,... |
---|
940 | % % 'ExecutionMode','fixedRate','Period',0.333,'TasksToExecute',10); |
---|
941 | % |
---|
942 | % % timer1=timer('StartDelay',1,... |
---|
943 | % % 'ExecutionMode','fixedRate','Period',0.333,'TasksToExecute',10); |
---|
944 | % % timer1.TimerFcn = {@mycallback, hObject,eventdata, handles}; |
---|
945 | % |
---|
946 | % %figure(1); |
---|
947 | % %axes(handles.axes1); |
---|
948 | % timer1 = getappdata(handles.figure1,'Timer'); |
---|
949 | % start(timer1); |
---|
950 | |
---|
951 | % % --- Executes on button press in imageOFF_radiobutton. |
---|
952 | % function imageOFF_radiobutton_Callback(hObject, eventdata, handles) |
---|
953 | % % hObject handle to imageOFF_radiobutton (see GCBO) |
---|
954 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
955 | % % handles structure with handles and user data (see GUIDATA) |
---|
956 | % |
---|
957 | % % Hint: get(hObject,'Value') returns toggle state of imageOFF_radiobutton |
---|
958 | % |
---|
959 | % timer1 = getappdata(handles.figure1,'Timer'); |
---|
960 | % delete(timer1); |
---|
961 | |
---|
962 | |
---|
963 | % % function buttongroup(hObject, eventdata, handles) |
---|
964 | % % h = uibuttongroup('visible','off','Position',[0 .9 .1 .1]); |
---|
965 | % % u0 = uicontrol('Style','Radio','String','Option 1',... |
---|
966 | % % 'pos',[10 350 80 30],'parent',h,'HandleVisibility','off'); |
---|
967 | % % u1 = uicontrol('Style','Radio','String','Option 2',... |
---|
968 | % % 'pos',[10 250 80 30],'parent',h,'HandleVisibility','off'); |
---|
969 | % % u2 = uicontrol('Style','Radio','String','Option 3',... |
---|
970 | % % 'pos',[10 150 80 30],'parent',h,'HandleVisibility','off'); |
---|
971 | % % set(h,'SelectionChangeFcn',@selcbk); |
---|
972 | % % set(h,'SelectedObject',[]); % No selection |
---|
973 | % % set(h,'Visible','on'); |
---|
974 | |
---|
975 | % function selcbk(source,eventdata) |
---|
976 | % disp(source); |
---|
977 | % disp('toto'); |
---|
978 | % disp([eventdata.EventName,' ',... |
---|
979 | % get(eventdata.OldValue,'String'),' ', ... |
---|
980 | % get(eventdata.NewValue,'String')]); |
---|
981 | % disp(get(get(source,'SelectedObject'),'String')); |
---|
982 | |
---|
983 | function uibuttongroup_SelectionChangeFcn(hObject,eventdata,handles) |
---|
984 | % hObject handle to uipanel1 (see GCBO) |
---|
985 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
986 | % handles structure with handles and user data (see GUIDATA) |
---|
987 | |
---|
988 | timer1 = getappdata(handles.figure1,'Timer'); |
---|
989 | switch get(get(hObject,'SelectedObject'),'Tag') % Get Tag of selected object |
---|
990 | case 'radiobutton1' |
---|
991 | % code piece when radiobutton1 is selected goes here |
---|
992 | disp('image video <-') |
---|
993 | start(timer1); |
---|
994 | case 'radiobutton2' |
---|
995 | % code piece when radiobutton2 is selected goes here |
---|
996 | disp('image video ->') |
---|
997 | stop(timer1); |
---|
998 | end |
---|
999 | |
---|
1000 | |
---|
1001 | % % --- Executes on button press in imageON_radiobutton. |
---|
1002 | % function imageON_radiobutton_Callback(hObject, eventdata, handles) |
---|
1003 | % % hObject handle to imageON_radiobutton (see GCBO) |
---|
1004 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
1005 | % % handles structure with handles and user data (see GUIDATA) |
---|
1006 | % |
---|
1007 | % % Hint: get(hObject,'Value') returns toggle state of imageON_radiobutton |
---|
1008 | % |
---|
1009 | % timer1 = getappdata(handles.figure1,'Timer'); |
---|
1010 | % start(timer1); |
---|
1011 | |
---|
1012 | |
---|
1013 | function mutual_exclude(off) |
---|
1014 | set(off,'Value',0) |
---|
1015 | |
---|
1016 | % --- Executes on button press in calibON_radiobutton5. |
---|
1017 | function calibON_radiobutton5_Callback(hObject, eventdata, handles) |
---|
1018 | % hObject handle to calibON_radiobutton5 (see GCBO) |
---|
1019 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1020 | % handles structure with handles and user data (see GUIDATA) |
---|
1021 | |
---|
1022 | % Hint: get(hObject,'Value') returns toggle state of calibON_radiobutton5 |
---|
1023 | off = [handles.calibOFF_radiobutton6]; |
---|
1024 | mutual_exclude(off) |
---|
1025 | |
---|
1026 | % alias |
---|
1027 | device_name = getappdata(handles.figure1,'device_name'); |
---|
1028 | |
---|
1029 | % positionner le miroir EN, allumer le backlight |
---|
1030 | %idem pb cï¿œblage miroir LT2 provisoirement modif dans MATLAB |
---|
1031 | %tango_command_inout(device_name.miroir,'On'); |
---|
1032 | tango_command_inout(device_name.miroir,'Off'); |
---|
1033 | tango_command_inout(device_name.backlight,'SetBrightness',uint16(6)); |
---|
1034 | |
---|
1035 | %____________________________________________________________________ |
---|
1036 | % positionner le popupmenu du backlight a la valeur effective |
---|
1037 | lumiere=tango_command_inout(device_name.backlight,'GetBrightness'); |
---|
1038 | |
---|
1039 | %- check error |
---|
1040 | if (tango_error == -1) |
---|
1041 | %- handle error |
---|
1042 | tango_print_error_stack; |
---|
1043 | return; |
---|
1044 | else |
---|
1045 | set(handles.backlight_popupmenu3,'Value',lumiere); |
---|
1046 | end |
---|
1047 | |
---|
1048 | %rendre la possibilitᅵ de calibrer et de bouger les lentilles |
---|
1049 | set([handles.Lenthaute_radiobutton7,handles.tata_radiobutton10,... |
---|
1050 | handles.ppp_pushbutton18,handles.pp_pushbutton19,handles.p_pushbutton20... |
---|
1051 | handles.mmm_pushbutton21,handles.mm_pushbutton22,handles.m_pushbutton23... |
---|
1052 | handles.backlight_popupmenu3,... |
---|
1053 | handles.Gmax_pushbutton26,handles.Gmoy_pushbutton27,handles.Gmin_pushbutton28,... |
---|
1054 | handles.qualite_edit23,handles.G_edit12,... |
---|
1055 | handles.pos1_edit29,handles.pos2_edit30... |
---|
1056 | handles.text45,handles.text39,handles.text26,handles.text41... |
---|
1057 | handles.calib_pushbutton7],'Enable','on') |
---|
1058 | % handles.backlight_pushbutton24,handles.iris_pushbutton25,... |
---|
1059 | |
---|
1060 | % --- Executes on button press in calibOFF_radiobutton6. |
---|
1061 | function calibOFF_radiobutton6_Callback(hObject, eventdata, handles) |
---|
1062 | % hObject handle to calibOFF_radiobutton6 (see GCBO) |
---|
1063 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1064 | % handles structure with handles and user data (see GUIDATA) |
---|
1065 | |
---|
1066 | % Hint: get(hObject,'Value') returns toggle state of calibOFF_radiobutton6 |
---|
1067 | off = [handles.calibON_radiobutton5]; |
---|
1068 | mutual_exclude(off) |
---|
1069 | |
---|
1070 | % alias |
---|
1071 | |
---|
1072 | device_name = getappdata(handles.figure1,'device_name'); |
---|
1073 | %getappdata(handles.figure1,'backlight'); |
---|
1074 | |
---|
1075 | % positionner le miroir HORS, eteindre le backlight |
---|
1076 | % provisoirement pb de cï¿œblage du miroir LT2 et modif dans MATLAB |
---|
1077 | %tango_command_inout(device_name.miroir,'Off'); |
---|
1078 | tango_command_inout(device_name.miroir,'On'); |
---|
1079 | tango_command_inout(device_name.backlight,'SetBrightness',uint16(0)); |
---|
1080 | |
---|
1081 | %% inserer l'écran YAG |
---|
1082 | %tango_command_inout(device_name.ecran,'Insert'); |
---|
1083 | %fonction_error; |
---|
1084 | |
---|
1085 | %exclure la possibilitᅵ de calibrer et de bouger les lentilles |
---|
1086 | set([handles.Lenthaute_radiobutton7,handles.tata_radiobutton10,... |
---|
1087 | handles.ppp_pushbutton18,handles.pp_pushbutton19,handles.p_pushbutton20... |
---|
1088 | handles.mmm_pushbutton21,handles.mm_pushbutton22,handles.m_pushbutton23... |
---|
1089 | handles.backlight_popupmenu3,... |
---|
1090 | handles.Gmax_pushbutton26,handles.Gmoy_pushbutton27,handles.Gmin_pushbutton28,... |
---|
1091 | handles.qualite_edit23,handles.G_edit12,... |
---|
1092 | handles.pos1_edit29,handles.pos2_edit30... |
---|
1093 | handles.text45,handles.text39,handles.text26,handles.text41... |
---|
1094 | handles.calib_pushbutton7],'Enable','off') |
---|
1095 | %handles.backlight_pushbutton24,handles.iris_pushbutton25,... |
---|
1096 | |
---|
1097 | % --- Executes during object creation, after setting all properties. |
---|
1098 | function G_edit12_CreateFcn(hObject, eventdata, handles) |
---|
1099 | % hObject handle to G_edit12 (see GCBO) |
---|
1100 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1101 | % handles empty - handles not created until after all CreateFcns called |
---|
1102 | |
---|
1103 | % Hint: edit controls usually have a white background on Windows. |
---|
1104 | % See ISPC and COMPUTER. |
---|
1105 | if ispc |
---|
1106 | set(hObject,'BackgroundColor','white'); |
---|
1107 | else |
---|
1108 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1109 | end |
---|
1110 | |
---|
1111 | |
---|
1112 | |
---|
1113 | function G_edit12_Callback(hObject, eventdata, handles) |
---|
1114 | % hObject handle to G_edit12 (see GCBO) |
---|
1115 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1116 | % handles structure with handles and user data (see GUIDATA) |
---|
1117 | |
---|
1118 | % Hints: get(hObject,'String') returns contents of G_edit12 as text |
---|
1119 | % str2double(get(hObject,'String')) returns contents of G_edit12 as a double |
---|
1120 | |
---|
1121 | |
---|
1122 | |
---|
1123 | |
---|
1124 | |
---|
1125 | % ------------------------------------------------------------ |
---|
1126 | % Callback for the Remove push button |
---|
1127 | % ------------------------------------------------------------ |
---|
1128 | % --- Executes on button press in remove_pushbutton. |
---|
1129 | function remove_pushbutton_Callback(hObject, eventdata, handles) |
---|
1130 | % hObject handle to remove_pushbutton (see GCBO) |
---|
1131 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1132 | % handles structure with handles and user data (see GUIDATA) |
---|
1133 | |
---|
1134 | % Callback of the uicontrol handles.RemoveButton. |
---|
1135 | %essai |
---|
1136 | %handles.nbremove=handles.nbremove+1 |
---|
1137 | |
---|
1138 | currentVal = get(handles.listbox1,'Value') |
---|
1139 | resultsStr = get(handles.listbox1,'String') |
---|
1140 | numResults = size(resultsStr,1) |
---|
1141 | |
---|
1142 | |
---|
1143 | % Remove the data and list entry for the selected value |
---|
1144 | |
---|
1145 | handles.Ecran=getappdata(handles.figure1,'Ecran'); |
---|
1146 | % handles.Sauver contient la structure du rᅵsultat ᅵ effacer |
---|
1147 | handles.Sauver=getappdata(handles.figure1,'Sauver'); |
---|
1148 | if isequal( handles.Ecran,{[]}) |
---|
1149 | handles.Ecran= resultsStr(currentVal); |
---|
1150 | else |
---|
1151 | handles.Ecran=[ handles.Ecran ; resultsStr(currentVal)]; |
---|
1152 | end |
---|
1153 | resultsStr(currentVal) =[]; |
---|
1154 | resultats=getappdata(handles.figure1,'ResultsData'); |
---|
1155 | %%NumeroRemove=resultats(currentVal).RunNumber; |
---|
1156 | if isequal( handles.Sauver,struct([])) |
---|
1157 | handles.Sauver=resultats(currentVal); |
---|
1158 | else |
---|
1159 | handles.Sauver=[handles.Sauver resultats(currentVal)]; |
---|
1160 | end |
---|
1161 | |
---|
1162 | resultats(currentVal)=[]; |
---|
1163 | setappdata(handles.figure1,'ResultsData',resultats); |
---|
1164 | handles.ResultsData = resultats; |
---|
1165 | |
---|
1166 | %essai |
---|
1167 | %restoreRes(handles.nbremove)=resultats(currentVal) |
---|
1168 | %handles.restore=handles.remove+1; |
---|
1169 | if ~isequal(numResults,1) |
---|
1170 | set([handles.restaurer_pushbutton15],'Enable','on') |
---|
1171 | end |
---|
1172 | % If there are no other entries, disable the Remove and Plot button |
---|
1173 | % and change the list sting to <empty> |
---|
1174 | if isequal(numResults,1) |
---|
1175 | resultsStr = {'<vide !!>'}; |
---|
1176 | currentVal = 1; |
---|
1177 | set([handles.remove_pushbutton,handles.plot_pushbutton,... |
---|
1178 | handles.restaurer_pushbutton15],'Enable','off') |
---|
1179 | end |
---|
1180 | |
---|
1181 | |
---|
1182 | |
---|
1183 | % Ensure that list box Value is valid, then reset Value and String |
---|
1184 | currentVal = min(currentVal,size(resultsStr,1)); |
---|
1185 | set(handles.listbox1,'Value',currentVal,'String',resultsStr) |
---|
1186 | |
---|
1187 | % Store the new ResultsData |
---|
1188 | setappdata(handles.figure1,'Sauver',handles.Sauver); |
---|
1189 | setappdata(handles.figure1,'Ecran',handles.Ecran); |
---|
1190 | set(handles.nbacqu_edit13,'String', num2str(size(resultsStr,1))); |
---|
1191 | |
---|
1192 | % affiche le nombre de data utilisï¿œs dans le calcul d'ï¿œmittance |
---|
1193 | %%en attente set(handles.nbacqu_edit13,'String',num2str(length(resultats))); |
---|
1194 | |
---|
1195 | guidata(hObject, handles); |
---|
1196 | |
---|
1197 | % --- Executes on button press in emittance_pushbutton12. |
---|
1198 | function emittance_pushbutton12_Callback(hObject, eventdata, handles) |
---|
1199 | % hObject handle to emittance_pushbutton12 (see GCBO) |
---|
1200 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1201 | % handles structure with handles and user data (see GUIDATA) |
---|
1202 | % calcul d'emittance |
---|
1203 | |
---|
1204 | handles.ResultsData = getappdata(handles.figure1,'ResultsData'); |
---|
1205 | largeur_option = getappdata(handles.figure1,'largeur_option'); |
---|
1206 | |
---|
1207 | switch largeur_option |
---|
1208 | case 1 |
---|
1209 | % fit par gaussienne largeur_option = 1 |
---|
1210 | set(handles.type_edit36,'String','rms (fit)'); |
---|
1211 | case 2 |
---|
1212 | % vrai rms largeur_option = 2 |
---|
1213 | set(handles.type_edit36,'String','vrai rms'); |
---|
1214 | |
---|
1215 | case 3 |
---|
1216 | % rayon ᅵ X % largeur_option = 3 |
---|
1217 | set(handles.type_edit36,'String','Ã X %'); |
---|
1218 | end |
---|
1219 | |
---|
1220 | |
---|
1221 | % les vecteurs sx et sy sont déjà les valeurs moyennᅵes sur nbiter iterations |
---|
1222 | for i=1:length(handles.ResultsData) |
---|
1223 | sx(i) = handles.ResultsData(i).LargeurH; |
---|
1224 | sy(i) = handles.ResultsData(i).LargeurV; |
---|
1225 | I(i)= handles.ResultsData(i).Q4courant; |
---|
1226 | end |
---|
1227 | %%I = [1 2 3 4] |
---|
1228 | |
---|
1229 | % transformation courant - force quadrupolaire |
---|
1230 | % ï¿œtalonnage de Q7 (si on a le temps prï¿œfï¿œrez ï¿œtalonnage Q4, mais pas trop important) |
---|
1231 | % ATTENTION nᅵcessitᅵ de connaotre m'ᅵnergie de la ligne (he oui ce n'est |
---|
1232 | % pas simple) A RENTRER A LA MAIN DANS L'INTERFACE |
---|
1233 | res = get(handles.energie_edit38,'String'); |
---|
1234 | if isequal(res,'ENERGIE') |
---|
1235 | errordlg('vous n''avez pas rentré l''énergie de la ligne !','Attention'); |
---|
1236 | return |
---|
1237 | end |
---|
1238 | Energie = Str2num(get(handles.energie_edit38,'String'))*0.001; |
---|
1239 | %t = amp2k4LT1(I,[-1.49e-6 2.59e-5 -1.93e-4 4.98e-2 8.13e-4 ]/0.15 , 1,Energie) |
---|
1240 | %Family, Field, Amps, DeviceList, Energy, C, K2AmpScaleFactor |
---|
1241 | %t = amp2k4LT1('QP','SetPoint',I, [1 4], Energie,[-1.49e-6 2.59e-5 -1.93e-4 4.98e-2 8.13e-4 ]/0.15,1) |
---|
1242 | |
---|
1243 | % Attention à l'étalonnage du gradient qui n'est valable que pour les |
---|
1244 | % valeurs absolues des courants. Mais OK pour Q4 qui est conv Horiz |
---|
1245 | t = hw2physics('QP','Setpoint',I,[1 4],Energie)'; |
---|
1246 | %% tests ! |
---|
1247 | %t=[4.298 3.5 3.9 4.6 5.1 5.6 6.2]'; |
---|
1248 | %sx=[1.641 3.823 2.703 0.977 1.173 2.424 4.074]; |
---|
1249 | %sy=[1.641 3.823 2.703 0.977 1.173 2.424 4.074]; |
---|
1250 | |
---|
1251 | % constantes de la ligne de transfert |
---|
1252 | % valeur vérifiée sur 3D D Zerbib 11 février 2005 |
---|
1253 | |
---|
1254 | Drift = [0.150 1.669 0.85415 2.400 0.950 3.79286]; |
---|
1255 | % % point 0 simulation barelattice_LT1 ᅵ entrᅵe Lmag Q1 |
---|
1256 | % drift1 = 1.669 |
---|
1257 | % % sortie Lmag Q1 entrï¿œe Lmag Q2 |
---|
1258 | % drift2 = 1.00415 - 0.150 = 0.85415 |
---|
1259 | % % sortie Lmag Q2 entrï¿œe Lmag Q3 |
---|
1260 | % drift3 = 2.550 - 0.150 = 2.400 |
---|
1261 | % % sortie Lmag Q3 entrï¿œe Lmag Q4 |
---|
1262 | % drift4 = 1.100 - 0.150 = 0.95 |
---|
1263 | % % sortie L magnï¿œtique Qpï¿œle - centre ï¿œmittance |
---|
1264 | % drift5 = 3867,86 - 150/2 = 3792.86 |
---|
1265 | setappdata(handles.figure1,'Drift',Drift) |
---|
1266 | Lq = Drift(1); |
---|
1267 | Ld = Drift(6); |
---|
1268 | Md = [1 Ld ; 0 1]; |
---|
1269 | |
---|
1270 | % plan HORIZONTAL |
---|
1271 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1272 | % calcul des elements de la matrice de transport entre le Qpole et le point de mesure |
---|
1273 | |
---|
1274 | % tailles en unité standard |
---|
1275 | sx = sx * 0.001; |
---|
1276 | sx2=sx.*sx; |
---|
1277 | |
---|
1278 | Mx11=zeros(length(t),1); |
---|
1279 | Mx12=zeros(length(t),1); |
---|
1280 | for i = 1:length(t) |
---|
1281 | clear('Mxq','Mxtransport') |
---|
1282 | Mxq=[cos(Lq*sqrt(t(i))) (1/sqrt(t(i)))*sin(Lq*sqrt(t(i))) ; ... |
---|
1283 | -sqrt(t(i))*sin(Lq*sqrt(t(i))) cos(Lq*sqrt(t(i)))]; |
---|
1284 | Mxtransport=Md*Mxq; |
---|
1285 | Mx11(i)=Mxtransport(1,1); |
---|
1286 | Mx12(i)=Mxtransport(1,2); |
---|
1287 | end |
---|
1288 | |
---|
1289 | % *********** methode Belbeoch ********************** |
---|
1290 | A=Mx11.*Mx11; |
---|
1291 | B=Mx12.*Mx12; |
---|
1292 | F=2*Mx11.*Mx12 ; |
---|
1293 | |
---|
1294 | Z=[A'*A A'*B A'*F ; B'*A B'*B B'*F ; ... |
---|
1295 | F'*A F'*B F'*F]; |
---|
1296 | H=[A'*sx2' ; B'*sx2' ; F'*sx2']; |
---|
1297 | |
---|
1298 | twissx=Z\H; |
---|
1299 | % twissx(1) = sigma11(point origine) = Eps beta |
---|
1300 | % twissx(2) = sigma22(point origine) = Eps gamma |
---|
1301 | % twissx(3) = sigma12(point origine) = - Eps alpha |
---|
1302 | epsx = sqrt(twissx(1)*twissx(2)-twissx(3)*twissx(3)); |
---|
1303 | % affichage de l'emittance en mm mrad |
---|
1304 | emittanceH = sprintf('%3.2f',epsx*1e6) ; |
---|
1305 | set(handles.emitH_edit18,'String',emittanceH); |
---|
1306 | setappdata(handles.figure1,'Twissx',twissx); |
---|
1307 | |
---|
1308 | |
---|
1309 | % plan VERTICAL |
---|
1310 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1311 | % calcul des elements de la matrice de transport entre le Qpole et le point de mesure |
---|
1312 | |
---|
1313 | sy = sy * 1e-3; |
---|
1314 | sy2=sy.*sy; |
---|
1315 | |
---|
1316 | My11=zeros(length(t),1); |
---|
1317 | My12=zeros(length(t),1); |
---|
1318 | for i = 1:length(t) |
---|
1319 | clear('Myq','Mytransport') |
---|
1320 | Myq=[cosh(Lq*sqrt(t(i))) (1/sqrt(t(i)))*sinh(Lq*sqrt(t(i))) ; ... |
---|
1321 | sqrt(t(i))*sinh(Lq*sqrt(t(i))) cosh(Lq*sqrt(t(i)))]; |
---|
1322 | Mytransport=Md*Myq; |
---|
1323 | My11(i)=Mytransport(1,1); |
---|
1324 | My12(i)=Mytransport(1,2); |
---|
1325 | end |
---|
1326 | |
---|
1327 | % *********** methode Belbeoch ********************** |
---|
1328 | A=My11.*My11; |
---|
1329 | B=My12.*My12; |
---|
1330 | F=2*My11.*My12 ; |
---|
1331 | |
---|
1332 | Z=[A'*A A'*B A'*F ; B'*A B'*B B'*F ; ... |
---|
1333 | F'*A F'*B F'*F]; |
---|
1334 | H=[A'*sy2' ; B'*sy2' ; F'*sy2']; |
---|
1335 | |
---|
1336 | twissy=Z\H; |
---|
1337 | epsy = sqrt(twissy(1)*twissy(2)-twissy(3)*twissy(3)); |
---|
1338 | emittanceV = sprintf('%3.2f',epsy*1e6) ; |
---|
1339 | set(handles.emitV_edit19,'String',emittanceV); |
---|
1340 | setappdata(handles.figure1,'Twissy',twissy); |
---|
1341 | |
---|
1342 | |
---|
1343 | |
---|
1344 | % %$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ |
---|
1345 | % % Mesure de l'emittance par fit "Belbeoch" et distribution normale des |
---|
1346 | % % erreurs de mesures |
---|
1347 | % |
---|
1348 | % % valeurs exactes gradient t |
---|
1349 | % % valeurs exactes tailles de faisceau se |
---|
1350 | % % pourc = pourcentage d'erreur maximum sur la mesure de taille |
---|
1351 | % % Lq = Longueur du quadrupole |
---|
1352 | % % Ld = longueur du drift Qpole - point de mesure |
---|
1353 | % %--------------------------------------------------------- |
---|
1354 | % % |
---|
1355 | % |
---|
1356 | % %cla(figure(1)); |
---|
1357 | % |
---|
1358 | % % methode de calcul |
---|
1359 | % method = 'moyenne des acquisitions'; |
---|
1360 | % %method = 'moyenne des emittances' |
---|
1361 | % |
---|
1362 | % % erreur sur les mesures de taille / nb d'iterations sur une mesure/ pour |
---|
1363 | % % tester la validite de la methode : nb de tests |
---|
1364 | % sigma = 0.35; |
---|
1365 | % % ? nbiter=5; |
---|
1366 | % nbiter=1; |
---|
1367 | % nbtests=30000; |
---|
1368 | % |
---|
1369 | % % valeurs exactes de forces quadrupolaires et tailles de faisceau |
---|
1370 | % t=[4.298 3.5 3.9 4.6 5.1 5.6 6.2]'; |
---|
1371 | % se=[1.641 3.823 2.703 0.977 1.173 2.424 4.074]; |
---|
1372 | % |
---|
1373 | % % initialisations |
---|
1374 | % % ? eps=zeros(nbiter,1); |
---|
1375 | % eps=zeros(nbtests,1); |
---|
1376 | % Lq=0.15; |
---|
1377 | % Ld=3.8915; |
---|
1378 | % Md=[1 Ld ; 0 1]; |
---|
1379 | % st2=zeros(nbiter,length(t)); |
---|
1380 | % meanst2=zeros(1,length(t)); |
---|
1381 | % |
---|
1382 | % nbcomplexes=0; |
---|
1383 | % stdeps=1.; |
---|
1384 | % g=0; |
---|
1385 | % Z=zeros(3,3); |
---|
1386 | % |
---|
1387 | % |
---|
1388 | % % calcul des elements de la matrice de transport entre le Qpole et le point |
---|
1389 | % % de mesure |
---|
1390 | % M11=zeros(length(t),1); |
---|
1391 | % M12=zeros(length(t),1); |
---|
1392 | % for i = 1:length(t) |
---|
1393 | % clear('Mq','Mtransport') |
---|
1394 | % Mq=[cos(Lq*sqrt(t(i))) (1/sqrt(t(i)))*sin(Lq*sqrt(t(i))) ; ... |
---|
1395 | % -sqrt(t(i))*sin(Lq*sqrt(t(i))) cos(Lq*sqrt(t(i)))]; |
---|
1396 | % Mtransport=Md*Mq; |
---|
1397 | % M11(i)=Mtransport(1,1); |
---|
1398 | % M12(i)=Mtransport(1,2); |
---|
1399 | % end |
---|
1400 | % |
---|
1401 | % |
---|
1402 | % for j = 1:nbtests |
---|
1403 | % |
---|
1404 | % % calcul de l'emittance avec moyenne prealable de chaque acquisition sur les nbiter |
---|
1405 | % %iterations (5 dans le menu) (distribution normale dans cette simulation) |
---|
1406 | % for i=1:length(t) |
---|
1407 | % s=se(i)+sigma*se(i)*randn(nbiter,1); |
---|
1408 | % s2=s.*s; |
---|
1409 | % meanst2(i)=mean(s2); |
---|
1410 | % end |
---|
1411 | % |
---|
1412 | % % *********** methode Belbeoch ********************** |
---|
1413 | % A=M11.*M11; |
---|
1414 | % B=M12.*M12; |
---|
1415 | % F=2*M11.*M12 ; |
---|
1416 | % |
---|
1417 | % Z=[A'*A A'*B A'*F ; B'*A B'*B B'*F ; ... |
---|
1418 | % F'*A F'*B F'*F]; |
---|
1419 | % H=[A'*meanst2' ; B'*meanst2' ; F'*meanst2']; |
---|
1420 | % |
---|
1421 | % citer=Z\H; |
---|
1422 | % eps(j)=sqrt(citer(1)*citer(2)-citer(3)*citer(3)); |
---|
1423 | % nbcomplexes = 1-isreal(eps(j)) + nbcomplexes; |
---|
1424 | % if isequal(isreal(eps(j)),0) |
---|
1425 | % epsilon(j) = 0; |
---|
1426 | % else |
---|
1427 | % epsilon(j) = eps(j); |
---|
1428 | % end |
---|
1429 | % |
---|
1430 | % |
---|
1431 | % % emittanceH=num2str(eps) ; |
---|
1432 | % % set(handles.emitH_edit18,'String',emittanceH); |
---|
1433 | % |
---|
1434 | % |
---|
1435 | % end |
---|
1436 | % |
---|
1437 | % moyenne = mean(epsilon)*length(eps)/(length(eps)-nbcomplexes); |
---|
1438 | % for j=1:length(eps) |
---|
1439 | % if isequal(epsilon(j),0) |
---|
1440 | % sepsilon(j) = moyenne; |
---|
1441 | % else |
---|
1442 | % sepsilon(j) = epsilon(j); |
---|
1443 | % end |
---|
1444 | % end |
---|
1445 | % standard = std(sepsilon)*sqrt(length(eps)/(length(eps)-nbcomplexes)); |
---|
1446 | % disp(['nbcomplexes=' sprintf('%0.5g',nbcomplexes) ' sigma tailles=' sprintf('%0.5g',sigma) ... |
---|
1447 | % ' nbiter=' sprintf('%0.5g',nbiter) ... |
---|
1448 | % ' nbtests=' sprintf('%0.5g',nbtests) ' meaneps=' ... |
---|
1449 | % sprintf('%0.5g',moyenne) ' stdeps=' sprintf('%0.5g',standard)] ) |
---|
1450 | % disp(' ') |
---|
1451 | % |
---|
1452 | % %$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ |
---|
1453 | % |
---|
1454 | |
---|
1455 | |
---|
1456 | % --- Executes during object creation, after setting all properties. |
---|
1457 | function nbacqu_edit13_CreateFcn(hObject, eventdata, handles) |
---|
1458 | % hObject handle to nbacqu_edit13 (see GCBO) |
---|
1459 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1460 | % handles empty - handles not created until after all CreateFcns called |
---|
1461 | |
---|
1462 | % Hint: edit controls usually have a white background on Windows. |
---|
1463 | % See ISPC and COMPUTER. |
---|
1464 | if ispc |
---|
1465 | set(hObject,'BackgroundColor','white'); |
---|
1466 | else |
---|
1467 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1468 | end |
---|
1469 | |
---|
1470 | |
---|
1471 | |
---|
1472 | function nbacqu_edit13_Callback(hObject, eventdata, handles) |
---|
1473 | % hObject handle to nbacqu_edit13 (see GCBO) |
---|
1474 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1475 | % handles structure with handles and user data (see GUIDATA) |
---|
1476 | |
---|
1477 | % Hints: get(hObject,'String') returns contents of nbacqu_edit13 as text |
---|
1478 | % str2double(get(hObject,'String')) returns contents of nbacqu_edit13 as a double |
---|
1479 | |
---|
1480 | |
---|
1481 | % --- Executes during object creation, after setting all properties. |
---|
1482 | function edit14_CreateFcn(hObject, eventdata, handles) |
---|
1483 | % hObject handle to edit14 (see GCBO) |
---|
1484 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1485 | % handles empty - handles not created until after all CreateFcns called |
---|
1486 | |
---|
1487 | % Hint: edit controls usually have a white background on Windows. |
---|
1488 | % See ISPC and COMPUTER. |
---|
1489 | if ispc |
---|
1490 | set(hObject,'BackgroundColor','white'); |
---|
1491 | else |
---|
1492 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1493 | end |
---|
1494 | |
---|
1495 | |
---|
1496 | |
---|
1497 | function edit14_Callback(hObject, eventdata, handles) |
---|
1498 | % hObject handle to edit14 (see GCBO) |
---|
1499 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1500 | % handles structure with handles and user data (see GUIDATA) |
---|
1501 | |
---|
1502 | % Hints: get(hObject,'String') returns contents of edit14 as text |
---|
1503 | % str2double(get(hObject,'String')) returns contents of edit14 as a double |
---|
1504 | |
---|
1505 | |
---|
1506 | % --- Executes during object creation, after setting all properties. |
---|
1507 | function edit15_CreateFcn(hObject, eventdata, handles) |
---|
1508 | % hObject handle to edit15 (see GCBO) |
---|
1509 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1510 | % handles empty - handles not created until after all CreateFcns called |
---|
1511 | |
---|
1512 | % Hint: edit controls usually have a white background on Windows. |
---|
1513 | % See ISPC and COMPUTER. |
---|
1514 | if ispc |
---|
1515 | set(hObject,'BackgroundColor','white'); |
---|
1516 | else |
---|
1517 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1518 | end |
---|
1519 | |
---|
1520 | |
---|
1521 | |
---|
1522 | function edit15_Callback(hObject, eventdata, handles) |
---|
1523 | % hObject handle to edit15 (see GCBO) |
---|
1524 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1525 | % handles structure with handles and user data (see GUIDATA) |
---|
1526 | |
---|
1527 | % Hints: get(hObject,'String') returns contents of edit15 as text |
---|
1528 | % str2double(get(hObject,'String')) returns contents of edit15 as a double |
---|
1529 | |
---|
1530 | |
---|
1531 | % --- Executes during object creation, after setting all properties. |
---|
1532 | function edit16_CreateFcn(hObject, eventdata, handles) |
---|
1533 | % hObject handle to edit16 (see GCBO) |
---|
1534 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1535 | % handles empty - handles not created until after all CreateFcns called |
---|
1536 | |
---|
1537 | % Hint: edit controls usually have a white background on Windows. |
---|
1538 | % See ISPC and COMPUTER. |
---|
1539 | if ispc |
---|
1540 | set(hObject,'BackgroundColor','white'); |
---|
1541 | else |
---|
1542 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1543 | end |
---|
1544 | |
---|
1545 | |
---|
1546 | |
---|
1547 | function edit16_Callback(hObject, eventdata, handles) |
---|
1548 | % hObject handle to edit16 (see GCBO) |
---|
1549 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1550 | % handles structure with handles and user data (see GUIDATA) |
---|
1551 | |
---|
1552 | % Hints: get(hObject,'String') returns contents of edit16 as text |
---|
1553 | % str2double(get(hObject,'String')) returns contents of edit16 as a double |
---|
1554 | |
---|
1555 | |
---|
1556 | % --- Executes during object creation, after setting all properties. |
---|
1557 | function edit17_CreateFcn(hObject, eventdata, handles) |
---|
1558 | % hObject handle to edit17 (see GCBO) |
---|
1559 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1560 | % handles empty - handles not created until after all CreateFcns called |
---|
1561 | |
---|
1562 | % Hint: edit controls usually have a white background on Windows. |
---|
1563 | % See ISPC and COMPUTER. |
---|
1564 | if ispc |
---|
1565 | set(hObject,'BackgroundColor','white'); |
---|
1566 | else |
---|
1567 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1568 | end |
---|
1569 | |
---|
1570 | |
---|
1571 | |
---|
1572 | function edit17_Callback(hObject, eventdata, handles) |
---|
1573 | % hObject handle to edit17 (see GCBO) |
---|
1574 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1575 | % handles structure with handles and user data (see GUIDATA) |
---|
1576 | |
---|
1577 | % Hints: get(hObject,'String') returns contents of edit17 as text |
---|
1578 | % str2double(get(hObject,'String')) returns contents of edit17 as a double |
---|
1579 | |
---|
1580 | |
---|
1581 | % --- Executes during object creation, after setting all properties. |
---|
1582 | function emitH_edit18_CreateFcn(hObject, eventdata, handles) |
---|
1583 | % hObject handle to emitH_edit18 (see GCBO) |
---|
1584 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1585 | % handles empty - handles not created until after all CreateFcns called |
---|
1586 | |
---|
1587 | % Hint: edit controls usually have a white background on Windows. |
---|
1588 | % See ISPC and COMPUTER. |
---|
1589 | if ispc |
---|
1590 | set(hObject,'BackgroundColor','white'); |
---|
1591 | else |
---|
1592 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1593 | end |
---|
1594 | % emittance horizonale |
---|
1595 | |
---|
1596 | |
---|
1597 | |
---|
1598 | function emitH_edit18_Callback(hObject, eventdata, handles) |
---|
1599 | % hObject handle to emitH_edit18 (see GCBO) |
---|
1600 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1601 | % handles structure with handles and user data (see GUIDATA) |
---|
1602 | |
---|
1603 | % Hints: get(hObject,'String') returns contents of emitH_edit18 as text |
---|
1604 | % str2double(get(hObject,'String')) returns contents of emitH_edit18 as a double |
---|
1605 | |
---|
1606 | |
---|
1607 | % --- Executes during object creation, after setting all properties. |
---|
1608 | function emitV_edit19_CreateFcn(hObject, eventdata, handles) |
---|
1609 | % hObject handle to emitV_edit19 (see GCBO) |
---|
1610 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1611 | % handles empty - handles not created until after all CreateFcns called |
---|
1612 | |
---|
1613 | % Hint: edit controls usually have a white background on Windows. |
---|
1614 | % See ISPC and COMPUTER. |
---|
1615 | if ispc |
---|
1616 | set(hObject,'BackgroundColor','white'); |
---|
1617 | else |
---|
1618 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1619 | end |
---|
1620 | |
---|
1621 | |
---|
1622 | |
---|
1623 | function emitV_edit19_Callback(hObject, eventdata, handles) |
---|
1624 | % hObject handle to emitV_edit19 (see GCBO) |
---|
1625 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1626 | % handles structure with handles and user data (see GUIDATA) |
---|
1627 | |
---|
1628 | % Hints: get(hObject,'String') returns contents of emitV_edit19 as text |
---|
1629 | % str2double(get(hObject,'String')) returns contents of emitV_edit19 as a double |
---|
1630 | |
---|
1631 | |
---|
1632 | % --- Executes on button press in ellipse_pushbutton13. |
---|
1633 | function ellipse_pushbutton13_Callback(hObject, eventdata, handles) |
---|
1634 | % hObject handle to ellipse_pushbutton13 (see GCBO) |
---|
1635 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1636 | % handles structure with handles and user data (see GUIDATA) |
---|
1637 | |
---|
1638 | ellipse_v15(handles) |
---|
1639 | |
---|
1640 | |
---|
1641 | % --- Executes when figure1 window is resized. |
---|
1642 | function figure1_ResizeFcn(hObject, eventdata, handles) |
---|
1643 | % hObject handle to figure1 (see GCBO) |
---|
1644 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1645 | % handles structure with handles and user data (see GUIDATA) |
---|
1646 | |
---|
1647 | |
---|
1648 | % --- Executes during object creation, after setting all properties. |
---|
1649 | function listbox1_CreateFcn(hObject, eventdata, handles) |
---|
1650 | % hObject handle to listbox1 (see GCBO) |
---|
1651 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1652 | % handles empty - handles not created until after all CreateFcns called |
---|
1653 | |
---|
1654 | % Hint: listbox controls usually have a white background on Windows. |
---|
1655 | % See ISPC and COMPUTER. |
---|
1656 | if ispc |
---|
1657 | set(hObject,'BackgroundColor','white'); |
---|
1658 | else |
---|
1659 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1660 | end |
---|
1661 | |
---|
1662 | |
---|
1663 | % --- Executes on selection change in listbox1. |
---|
1664 | function listbox1_Callback(hObject, eventdata, handles) |
---|
1665 | % hObject handle to listbox1 (see GCBO) |
---|
1666 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1667 | % handles structure with handles and user data (see GUIDATA) |
---|
1668 | |
---|
1669 | % Hints: contents = get(hObject,'String') returns listbox1 contents as cell array |
---|
1670 | % contents{get(hObject,'Value')} returns selected item from listbox1 |
---|
1671 | |
---|
1672 | |
---|
1673 | % --- Executes on button press in radiobutton7_bh_l1. |
---|
1674 | function Lenthaute_radiobutton7_Callback(hObject, eventdata, handles) |
---|
1675 | % hObject handle to radiobutton7_bh_l1 (see GCBO) |
---|
1676 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1677 | % handles structure with handles and user data (see GUIDATA) |
---|
1678 | |
---|
1679 | % Hint: get(hObject,'Value') returns toggle state of Lenthaute_radiobutton7 |
---|
1680 | autre = [handles.tata_radiobutton10]; |
---|
1681 | mutual_exclude(autre) |
---|
1682 | |
---|
1683 | |
---|
1684 | |
---|
1685 | |
---|
1686 | % --- Executes on button press in radiobutton10_bh_l2. |
---|
1687 | function tata_radiobutton10_Callback(hObject, eventdata, handles) |
---|
1688 | % hObject handle to radiobutton10_bh_l2 (see GCBO) |
---|
1689 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1690 | % handles structure with handles and user data (see GUIDATA) |
---|
1691 | |
---|
1692 | % Hint: get(hObject,'Value') returns toggle state of radiobutton10_bh_l2 |
---|
1693 | autre = [handles.Lenthaute_radiobutton7]; |
---|
1694 | mutual_exclude(autre) |
---|
1695 | |
---|
1696 | |
---|
1697 | |
---|
1698 | |
---|
1699 | |
---|
1700 | |
---|
1701 | % --- Executes on button press in restaurer_pushbutton15. |
---|
1702 | function restaurer_pushbutton15_Callback(hObject, eventdata, handles) |
---|
1703 | % hObject handle to restaurer_pushbutton15 (see GCBO) |
---|
1704 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1705 | % handles structure with handles and user data (see GUIDATA) |
---|
1706 | |
---|
1707 | % Restore the data and list entry for the last deleted value |
---|
1708 | ResultsStr = get(handles.listbox1,'String'); |
---|
1709 | handles.Sauver=getappdata(handles.figure1,'Sauver'); |
---|
1710 | handles.Ecran=getappdata(handles.figure1,'Ecran'); |
---|
1711 | handles.ResultsData=getappdata(handles.figure1,'ResultsData'); |
---|
1712 | |
---|
1713 | LastValue=length(handles.Sauver) ; |
---|
1714 | toto=handles.Sauver(LastValue); |
---|
1715 | titi=handles.Ecran(LastValue); |
---|
1716 | Numero=toto.RunNumber; |
---|
1717 | Nombre=length(handles.ResultsData); |
---|
1718 | reussite=0; |
---|
1719 | |
---|
1720 | if Numero>handles.ResultsData(Nombre).RunNumber |
---|
1721 | handles.ResultsData=[handles.ResultsData toto]; |
---|
1722 | ResultsStr = [ResultsStr ; titi]; |
---|
1723 | else |
---|
1724 | i=0; |
---|
1725 | while isequal(reussite,0) & (i<(length(handles.ResultsData))) |
---|
1726 | i= i+1 ; |
---|
1727 | if Numero>handles.ResultsData(Nombre-i+1).RunNumber |
---|
1728 | handles.ResultsData=[handles.ResultsData(1:Nombre-i+1) toto handles.ResultsData(Nombre-i+2:end)]; |
---|
1729 | ResultsStr = [ResultsStr(1:Nombre-i+1) ; titi;ResultsStr(Nombre-i+2:end) ]; |
---|
1730 | reussite=reussite+1; |
---|
1731 | end |
---|
1732 | |
---|
1733 | end |
---|
1734 | if isequal(reussite,0) |
---|
1735 | handles.ResultsData=[toto handles.ResultsData]; |
---|
1736 | ResultsStr = [titi ; ResultsStr]; |
---|
1737 | end |
---|
1738 | |
---|
1739 | end |
---|
1740 | |
---|
1741 | % Build the new results list string for the listbox |
---|
1742 | set(handles.listbox1,'String',ResultsStr); |
---|
1743 | |
---|
1744 | % Store the new ResultsData |
---|
1745 | handles.Sauver(LastValue)=[]; |
---|
1746 | handles.Ecran(LastValue)=[]; |
---|
1747 | setappdata(handles.figure1,'Sauver',handles.Sauver) |
---|
1748 | setappdata(handles.figure1,'Ecran',handles.Ecran) |
---|
1749 | setappdata(handles.figure1,'ResultsData',handles.ResultsData); |
---|
1750 | |
---|
1751 | % affiche le nombre de data utilisï¿œs dans le calcul d'ï¿œmittance |
---|
1752 | set(handles.nbacqu_edit13,'String', num2str(size(ResultsStr,1))); |
---|
1753 | |
---|
1754 | |
---|
1755 | % dï¿œsactiver le bouton restaurer si la liste est vide |
---|
1756 | if isequal(LastValue,1) |
---|
1757 | set([handles.restaurer_pushbutton15],'Enable','off') |
---|
1758 | end |
---|
1759 | guidata(hObject, handles); |
---|
1760 | |
---|
1761 | |
---|
1762 | % --- Executes on button press in mesuressfaisceau_pushbutton16. |
---|
1763 | function mesuressfaisceau_pushbutton16_Callback(hObject, eventdata, handles) |
---|
1764 | % hObject handle to mesuressfaisceau_pushbutton16 (see GCBO) |
---|
1765 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1766 | % handles structure with handles and user data (see GUIDATA) |
---|
1767 | |
---|
1768 | % sauvegarde sur disque de l'ensemble des acquisitions avec et sans |
---|
1769 | % faisceau, proposee lorsque aucune acquisition avec faiseau n'est encore |
---|
1770 | % faite |
---|
1771 | entree= getappdata(handles.figure1,'ResultsData'); |
---|
1772 | directory_principale = getappdata(handles.figure1,'directory_principale'); |
---|
1773 | if isequal(length(entree),0) |
---|
1774 | |
---|
1775 | %ouvrir le dossier pour l'enregistrement des profils |
---|
1776 | prompt={'entrer un nom de rï¿œpertoire'}; |
---|
1777 | name='SAUVEGARDE SUR DISQUE'; |
---|
1778 | numlines=1; |
---|
1779 | defaultanswer={strcat(datestr(clock,29),'_1')}; |
---|
1780 | options.Resize='on'; |
---|
1781 | options.WindowStyle='normal'; |
---|
1782 | options.Interpreter='tex'; |
---|
1783 | |
---|
1784 | % on ne propose la boite de dialogue qu'une seule fois |
---|
1785 | % ulterieurement, si on souhaite changer de directory de sauvegarde, |
---|
1786 | % cela se fait interactivement dans le ' ' |
---|
1787 | val=getappdata(handles.figure1,'init_sauvegarde'); |
---|
1788 | directory_principale=getappdata(handles.figure1,'directory_principale'); |
---|
1789 | |
---|
1790 | while isequal(val,0) |
---|
1791 | directory=inputdlg(prompt,name,numlines,defaultanswer,options); |
---|
1792 | % chemin=strcat('/home/PM/tordeux/matlab_test/',directory{:}); |
---|
1793 | %%directory_sauvegarde=strcat(directory_principale,directory{:}); |
---|
1794 | directory_sauvegarde=strcat(directory_principale,directory{:},'/'); |
---|
1795 | setappdata(handles.figure1,'directory_sauvegarde',directory_sauvegarde); |
---|
1796 | |
---|
1797 | |
---|
1798 | % cas ou un nom de directory a ᅵtᅵ rentrᅵ |
---|
1799 | if ~isequal(directory,{}) |
---|
1800 | % cas ou la directory n'existe pas |
---|
1801 | %%if ~isdir(strcat('/home/PM/tordeux/matlab_test/',directory{:})) |
---|
1802 | if ~isdir(directory_sauvegarde) |
---|
1803 | % mkdir(chemin) |
---|
1804 | % cd(chemin); |
---|
1805 | mkdir(directory_sauvegarde) |
---|
1806 | cd(directory_sauvegarde); |
---|
1807 | |
---|
1808 | setappdata(handles.figure1,'init_sauvegarde',1); |
---|
1809 | val=getappdata(handles.figure1,'init_sauvegarde'); |
---|
1810 | set(handles.directory_sauvegarde_edit28,'String',directory_sauvegarde); |
---|
1811 | |
---|
1812 | % cas ou la directory existe deja |
---|
1813 | else |
---|
1814 | button = questdlg('ce dossier existe ! voulez-vous continuer?','ATTENTION','oui','non','non') ; |
---|
1815 | if isequal(button,'oui') |
---|
1816 | |
---|
1817 | % cd(chemin); |
---|
1818 | cd(directory_sauvegarde); |
---|
1819 | |
---|
1820 | setappdata(handles.figure1,'init_sauvegarde',1); |
---|
1821 | val=getappdata(handles.figure1,'init_sauvegarde'); |
---|
1822 | set(handles.directory_sauvegarde_edit28,'String',directory_sauvegarde); |
---|
1823 | |
---|
1824 | else |
---|
1825 | % retour ᅵ la case dᅵpart |
---|
1826 | |
---|
1827 | end |
---|
1828 | end |
---|
1829 | |
---|
1830 | % cas ou on a refusᅵ de rentrer un nom de directory |
---|
1831 | else |
---|
1832 | |
---|
1833 | errordlg('vous n''avez pas sᅵlectionnᅵ de directory de sauvegarde !','Attention'); |
---|
1834 | |
---|
1835 | setappdata(handles.figure1,'init_sauvegarde',1); |
---|
1836 | val=getappdata(handles.figure1,'init_sauvegarde'); |
---|
1837 | end |
---|
1838 | |
---|
1839 | end |
---|
1840 | |
---|
1841 | end |
---|
1842 | |
---|
1843 | |
---|
1844 | showsansfgui_15(handles); |
---|
1845 | |
---|
1846 | |
---|
1847 | %__________________________________________________________________________ |
---|
1848 | % --- Executes on button press in Gmax_pushbutton26. |
---|
1849 | function Gmin_pushbutton28_Callback(hObject, eventdata, handles) |
---|
1850 | % hObject handle to Gmax_pushbutton26 (see GCBO) |
---|
1851 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1852 | % handles structure with handles and user data (see GUIDATA) |
---|
1853 | |
---|
1854 | |
---|
1855 | |
---|
1856 | % alias |
---|
1857 | device_name = getappdata(handles.figure1,'device_name'); |
---|
1858 | |
---|
1859 | % recuperer les valeurs de position des lentilles pour ce grandissement |
---|
1860 | posl1Gmin=getappdata(handles.figure1,'posl1Gmin'); |
---|
1861 | posl2Gmin=getappdata(handles.figure1,'posl2Gmin'); |
---|
1862 | |
---|
1863 | set(handles.Lenthaute_radiobutton7,'Value',0); |
---|
1864 | set(handles.tata_radiobutton10,'Value',0); |
---|
1865 | |
---|
1866 | % eteindre un voyant grandissement ᅵventuellement allumᅵ |
---|
1867 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
1868 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
1869 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
1870 | |
---|
1871 | dev=device_name.lentille_haute |
---|
1872 | |
---|
1873 | |
---|
1874 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
1875 | |
---|
1876 | if (tango_error == -1) |
---|
1877 | %- handle error |
---|
1878 | tango_print_error_stack; |
---|
1879 | return; |
---|
1880 | errordlg('erreur tango !','Erreur'); |
---|
1881 | |
---|
1882 | else |
---|
1883 | % cas ou l'axe n'est pas en butee backward (en haut) |
---|
1884 | % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens - |
---|
1885 | % errorstatus=4 limitswitch backward |
---|
1886 | |
---|
1887 | if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
1888 | |
---|
1889 | % si on est en butï¿œe basse forward on ï¿œteind le voyant |
---|
1890 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
1891 | set(handles.LHBB_edit24,'BackgroundColor',[0.702 0.702 0.702]); |
---|
1892 | end |
---|
1893 | |
---|
1894 | % aller en butee haute |
---|
1895 | tango_command_inout(dev,'AxisBackward'); |
---|
1896 | |
---|
1897 | % on attent que l'axe se mette en mouvement |
---|
1898 | %temporisation_mvt_axis(dev); |
---|
1899 | if (temporisation_mvt_axis(dev) == -1) |
---|
1900 | % abort |
---|
1901 | end |
---|
1902 | |
---|
1903 | % attendre la fin de la commande |
---|
1904 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
1905 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
1906 | pause(0.2); |
---|
1907 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
1908 | pause(0.2); |
---|
1909 | % on affiche la position de la lentille |
---|
1910 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
1911 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
1912 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green') |
---|
1913 | % pause(0.5); |
---|
1914 | end |
---|
1915 | % on affiche la position de la lentille |
---|
1916 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
1917 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
1918 | %set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
1919 | end |
---|
1920 | |
---|
1921 | % % si le moteur n'est pas en butee ce n'est pas normal.. |
---|
1922 | % if ~isequal(tango_command_inout(dev,'AxisGetMotionStatus'),-1) |
---|
1923 | % % probleme ! |
---|
1924 | % errordlg('bizzare, vous n''etes pas en butï¿œe...?!','Erreur'); |
---|
1925 | |
---|
1926 | % indiquer la butee haute sur moteur 1 (lentille haute) |
---|
1927 | set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
1928 | |
---|
1929 | % definir la position 0 |
---|
1930 | tango_command_inout(dev,'AxisDefinePosition',0); |
---|
1931 | |
---|
1932 | % avancer du nombre de pas exact correspondant au grandissement : 0 |
---|
1933 | |
---|
1934 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
1935 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
1936 | pause(0.2); |
---|
1937 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
1938 | pause(0.2); |
---|
1939 | % on affiche la position de la lentille |
---|
1940 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
1941 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
1942 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
1943 | % pause(0.5); |
---|
1944 | end |
---|
1945 | |
---|
1946 | % on affiche la position de la lentille |
---|
1947 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
1948 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
1949 | |
---|
1950 | %set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
1951 | |
---|
1952 | |
---|
1953 | end |
---|
1954 | |
---|
1955 | dev=device_name.lentille_basse |
---|
1956 | |
---|
1957 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
1958 | |
---|
1959 | if (tango_error == -1) |
---|
1960 | %- handle error |
---|
1961 | tango_print_error_stack; |
---|
1962 | return; |
---|
1963 | errordlg('erreur tango !','Erreur'); |
---|
1964 | |
---|
1965 | else |
---|
1966 | % cas ou l'axe n'est pas en butee backward (en haut) |
---|
1967 | % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens - |
---|
1968 | % errorstatus=4 limitswitch backward |
---|
1969 | |
---|
1970 | if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
1971 | |
---|
1972 | % si on est en butï¿œe basse forward on ï¿œteind le voyant |
---|
1973 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
1974 | set(handles.LBBB_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
1975 | end |
---|
1976 | |
---|
1977 | % aller en butee haute backward |
---|
1978 | tango_command_inout(dev,'AxisBackward'); |
---|
1979 | |
---|
1980 | % on attent que l'axe se mette en mouvement |
---|
1981 | %temporisation_mvt_axis(dev); |
---|
1982 | if (temporisation_mvt_axis(dev) == -1) |
---|
1983 | % abort |
---|
1984 | end |
---|
1985 | |
---|
1986 | % attendre la fin de la commande |
---|
1987 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
1988 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
1989 | pause(0.2); |
---|
1990 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
1991 | pause(0.2); |
---|
1992 | % on affiche la position de la lentille |
---|
1993 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
1994 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
1995 | % pause(0.2); |
---|
1996 | % set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
1997 | % pause(0.2); |
---|
1998 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
1999 | end |
---|
2000 | % on affiche la position de la lentille |
---|
2001 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2002 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2003 | set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2004 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2005 | end |
---|
2006 | |
---|
2007 | % % si le moteur n'est pas en butee ce n'est pas normal.. |
---|
2008 | % if ~isequal(tango_command_inout(dev,'AxisGetMotionStatus'),-1) |
---|
2009 | % % probleme ! |
---|
2010 | % errordlg('bizzare, vous n''etes pas en butï¿œe...?!','Erreur'); |
---|
2011 | % else |
---|
2012 | |
---|
2013 | % definir la position 0 |
---|
2014 | tango_command_inout(dev,'AxisDefinePosition',0); |
---|
2015 | % on affiche la position de la lentille |
---|
2016 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2017 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2018 | |
---|
2019 | % eteindre le voyant rouge butee backward s'il est allumᅵ |
---|
2020 | set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2021 | |
---|
2022 | % avancer du nombre de pas exact correspondant au grandissement |
---|
2023 | tango_command_inout(dev,'AxisGoToPosition',posl2Gmin); |
---|
2024 | |
---|
2025 | % on attent que l'axe se mette en mouvement |
---|
2026 | %temporisation_mvt_axis(dev); |
---|
2027 | if (temporisation_mvt_axis(dev) == -1) |
---|
2028 | % abort |
---|
2029 | end |
---|
2030 | |
---|
2031 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2032 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
2033 | pause(0.2); |
---|
2034 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2035 | pause(0.2); |
---|
2036 | % on affiche la position de la lentille |
---|
2037 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2038 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2039 | % pause(0.2); |
---|
2040 | % set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
2041 | % pause(0.2); |
---|
2042 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2043 | end |
---|
2044 | |
---|
2045 | % on affiche la position de la lentille |
---|
2046 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2047 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2048 | % ï¿œteindre le vert |
---|
2049 | %set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2050 | |
---|
2051 | |
---|
2052 | end |
---|
2053 | |
---|
2054 | % allumer le voyant rouge Gmin |
---|
2055 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition') |
---|
2056 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition') |
---|
2057 | test1 = test_position(pos1.value(1),posl1Gmin,5); |
---|
2058 | test2 = test_position(pos2.value(1),posl2Gmin,5); |
---|
2059 | if test1 == 1&test2==1 |
---|
2060 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
2061 | end |
---|
2062 | |
---|
2063 | %__________________________________________________________________________ |
---|
2064 | % --- Executes on button press in Gmoy_pushbutton27. |
---|
2065 | function Gmoy_pushbutton27_Callback(hObject, eventdata, handles) |
---|
2066 | % hObject handle to Gmoy_pushbutton27 (see GCBO) |
---|
2067 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2068 | % handles structure with handles and user data (see GUIDATA) |
---|
2069 | |
---|
2070 | % recuperer les valeurs de position des lentilles pour ce grandissement |
---|
2071 | posl1Gmoy=getappdata(handles.figure1,'posl1Gmoy'); |
---|
2072 | posl2Gmoy=getappdata(handles.figure1,'posl2Gmoy'); |
---|
2073 | device_name = getappdata(handles.figure1,'device_name'); |
---|
2074 | |
---|
2075 | set(handles.Lenthaute_radiobutton7,'Value',0); |
---|
2076 | set(handles.tata_radiobutton10,'Value',0); |
---|
2077 | |
---|
2078 | % eteindre un voyant grandissement ᅵventuellement allumᅵ |
---|
2079 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2080 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2081 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2082 | |
---|
2083 | dev=device_name.lentille_haute |
---|
2084 | |
---|
2085 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2086 | |
---|
2087 | if (tango_error == -1) |
---|
2088 | %- handle error |
---|
2089 | tango_print_error_stack; |
---|
2090 | return; |
---|
2091 | errordlg('erreur tango !','Erreur'); |
---|
2092 | |
---|
2093 | else |
---|
2094 | % cas ou l'axe n'est pas en butee backward (en haut) |
---|
2095 | % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens - |
---|
2096 | % errorstatus=4 limitswitch backward |
---|
2097 | |
---|
2098 | if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
2099 | |
---|
2100 | % si on est en butï¿œe basse forward on ï¿œteind le voyant |
---|
2101 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
2102 | set(handles.LHBB_edit24,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2103 | end |
---|
2104 | |
---|
2105 | % aller en butee haute |
---|
2106 | tango_command_inout(dev,'AxisBackward'); |
---|
2107 | |
---|
2108 | % on attent que l'axe se mette en mouvement |
---|
2109 | if (temporisation_mvt_axis(dev) == -1) |
---|
2110 | % abort |
---|
2111 | end |
---|
2112 | |
---|
2113 | % attendre la fin de la commande |
---|
2114 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2115 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
2116 | pause(0.2); |
---|
2117 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2118 | pause(0.2); |
---|
2119 | % on affiche la position de la lentille |
---|
2120 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2121 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2122 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green') |
---|
2123 | % pause(0.5); |
---|
2124 | end |
---|
2125 | % on affiche la position de la lentille |
---|
2126 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2127 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2128 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2129 | end |
---|
2130 | |
---|
2131 | % % si le moteur n'est pas en butee ce n'est pas normal.. |
---|
2132 | % if ~isequal(tango_command_inout(dev,'AxisGetMotionStatus'),-1) |
---|
2133 | % % probleme ! |
---|
2134 | % errordlg('bizzare, vous n''etes pas en butï¿œe...?!','Erreur'); |
---|
2135 | |
---|
2136 | % indiquer la butee haute sur moteur 1 (lentille haute) |
---|
2137 | set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
2138 | |
---|
2139 | % definir la position 0 |
---|
2140 | tango_command_inout(dev,'AxisDefinePosition',0); |
---|
2141 | fonction_error |
---|
2142 | % on affiche la position de la lentille |
---|
2143 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2144 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2145 | |
---|
2146 | status0 = tango_command_inout(dev,'AxisGetMotionStatus') |
---|
2147 | % avancer du nombre de pas exact correspondant au grandissement moyen : |
---|
2148 | tango_command_inout(dev,'AxisGoToPosition',posl1Gmoy); |
---|
2149 | fonction_error |
---|
2150 | % eteindre le voyant butï¿œe haute |
---|
2151 | set(handles.LHBH_edit25,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2152 | |
---|
2153 | % on attent que l'axe se mette en mouvement |
---|
2154 | %temporisation_mvt_axis(dev); |
---|
2155 | if (temporisation_mvt_axis(dev) == -1) |
---|
2156 | error = tango_command_inout(dev,'AxisGetMotionStatus') |
---|
2157 | disp('lentille haute') |
---|
2158 | % abort |
---|
2159 | end |
---|
2160 | |
---|
2161 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2162 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
2163 | pause(0.2); |
---|
2164 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2165 | pause(0.2); |
---|
2166 | % on affiche la position de la lentille |
---|
2167 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2168 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2169 | % pause(0.2); |
---|
2170 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2171 | % pause(0.2); |
---|
2172 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
2173 | end |
---|
2174 | |
---|
2175 | % on affiche la position de la lentille |
---|
2176 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2177 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2178 | set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2179 | |
---|
2180 | end |
---|
2181 | |
---|
2182 | dev=device_name.lentille_basse |
---|
2183 | |
---|
2184 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2185 | |
---|
2186 | if (tango_error == -1) |
---|
2187 | %- handle error |
---|
2188 | tango_print_error_stack; |
---|
2189 | return; |
---|
2190 | errordlg('erreur tango !','Erreur'); |
---|
2191 | |
---|
2192 | else |
---|
2193 | % cas ou l'axe n'est pas en butee backward (en haut) |
---|
2194 | % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens - |
---|
2195 | % errorstatus=4 limitswitch backward |
---|
2196 | |
---|
2197 | if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
2198 | |
---|
2199 | % si on est en butï¿œe basse forward on ï¿œteind le voyant |
---|
2200 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
2201 | set(handles.LBBB_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2202 | end |
---|
2203 | |
---|
2204 | % aller en butee haute backward |
---|
2205 | tango_command_inout(dev,'AxisBackward'); |
---|
2206 | |
---|
2207 | % on attent que l'axe se mette en mouvement |
---|
2208 | %temporisation_mvt_axis(dev); |
---|
2209 | if (temporisation_mvt_axis(dev) == -1) |
---|
2210 | % abort |
---|
2211 | disp('moy : abort') |
---|
2212 | end |
---|
2213 | |
---|
2214 | % au cas oᅵ la butᅵe haute est allumᅵe on l'ᅵteint |
---|
2215 | set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2216 | |
---|
2217 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2218 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
2219 | pause(0.2); |
---|
2220 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2221 | pause(0.2); |
---|
2222 | % on affiche la position de la lentille |
---|
2223 | %pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2224 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2225 | %set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2226 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2227 | % pause(0.2); |
---|
2228 | % set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
2229 | % pause(0.2); |
---|
2230 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2231 | end |
---|
2232 | |
---|
2233 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2234 | end |
---|
2235 | |
---|
2236 | % % si le moteur n'est pas en butee ce n'est pas normal.. |
---|
2237 | % if ~isequal(tango_command_inout(dev,'AxisGetMotionStatus'),-1) |
---|
2238 | % % probleme ! |
---|
2239 | % errordlg('bizzare, vous n''etes pas en butï¿œe...?!','Erreur'); |
---|
2240 | % else |
---|
2241 | |
---|
2242 | % definir la position 0 |
---|
2243 | tango_command_inout(dev,'AxisDefinePosition',0); |
---|
2244 | fonction_error; |
---|
2245 | |
---|
2246 | % on affiche la position de la lentille |
---|
2247 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2248 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2249 | |
---|
2250 | % eteindre le voyant rouge butee backward s'il est allumᅵ |
---|
2251 | set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2252 | |
---|
2253 | % avancer du nombre de pas exact correspondant au grandissement |
---|
2254 | tango_command_inout(dev,'AxisGoToPosition',posl2Gmoy); |
---|
2255 | |
---|
2256 | % on attent que l'axe se mette en mouvement |
---|
2257 | if (temporisation_mvt_axis(dev) == -1) |
---|
2258 | error = tango_command_inout(dev,'AxisGetMotionStatus') |
---|
2259 | % abort |
---|
2260 | end |
---|
2261 | |
---|
2262 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2263 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
2264 | pause(0.2); |
---|
2265 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2266 | pause(0.2); |
---|
2267 | % on affiche la position de la lentille |
---|
2268 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2269 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2270 | end |
---|
2271 | |
---|
2272 | % on affiche la position de la lentille |
---|
2273 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2274 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2275 | % % ï¿œteindre le vert |
---|
2276 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2277 | |
---|
2278 | |
---|
2279 | end |
---|
2280 | |
---|
2281 | % allumer le voyant rouge Gmoy |
---|
2282 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition') |
---|
2283 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition') |
---|
2284 | test1 = test_position(pos1.value(1),posl1Gmoy,5); |
---|
2285 | test2 = test_position(pos2.value(1),posl2Gmoy,5); |
---|
2286 | if test1 == 1&test2==1 |
---|
2287 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
2288 | end |
---|
2289 | |
---|
2290 | %__________________________________________________________________________ |
---|
2291 | % --- Executes on button press in Gmin_pushbutton28. |
---|
2292 | function Gmax_pushbutton26_Callback(hObject, eventdata, handles) |
---|
2293 | % hObject handle to Gmin_pushbutton28 (see GCBO) |
---|
2294 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2295 | % handles structure with handles and user data (see GUIDATA) |
---|
2296 | |
---|
2297 | % recuperer les valeurs de positions des lentilles pour ce grandissement |
---|
2298 | posl1Gmax=getappdata(handles.figure1,'posl1Gmax'); |
---|
2299 | posl2Gmax=getappdata(handles.figure1,'posl2Gmax'); |
---|
2300 | device_name = getappdata(handles.figure1,'device_name'); |
---|
2301 | |
---|
2302 | set(handles.Lenthaute_radiobutton7,'Value',0); |
---|
2303 | set(handles.tata_radiobutton10,'Value',0); |
---|
2304 | |
---|
2305 | % eteindre un voyant grandissement ᅵventuellement allumᅵ |
---|
2306 | |
---|
2307 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2308 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2309 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2310 | |
---|
2311 | |
---|
2312 | |
---|
2313 | dev=device_name.lentille_haute |
---|
2314 | |
---|
2315 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2316 | |
---|
2317 | if (tango_error == -1) |
---|
2318 | %- handle error |
---|
2319 | tango_print_error_stack; |
---|
2320 | return; |
---|
2321 | errordlg('erreur tango !','Erreur'); |
---|
2322 | |
---|
2323 | else |
---|
2324 | % cas ou l'axe n'est pas en butee backward (en haut) |
---|
2325 | % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens - |
---|
2326 | % errorstatus=4 limitswitch backward |
---|
2327 | |
---|
2328 | if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
2329 | |
---|
2330 | % si on est en butï¿œe basse forward on ï¿œteind le voyant |
---|
2331 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
2332 | set(handles.LHBB_edit24,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2333 | end |
---|
2334 | |
---|
2335 | % aller en butee haute |
---|
2336 | tango_command_inout(dev,'AxisBackward'); |
---|
2337 | |
---|
2338 | % on attent que l'axe se mette en mouvement |
---|
2339 | %temporisation_mvt_axis(dev); |
---|
2340 | if (temporisation_mvt_axis(dev) == -1) |
---|
2341 | % abort |
---|
2342 | end |
---|
2343 | |
---|
2344 | % attendre la fin de la commande |
---|
2345 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2346 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
2347 | pause(0.2); |
---|
2348 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2349 | pause(0.2); |
---|
2350 | % on affiche la position de la lentille |
---|
2351 | pos1=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
2352 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2353 | % pause(0.2); |
---|
2354 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green') |
---|
2355 | % pause(0.2); |
---|
2356 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]) |
---|
2357 | end |
---|
2358 | % on affiche la position de la lentille |
---|
2359 | pos1=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
2360 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2361 | %set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2362 | end |
---|
2363 | |
---|
2364 | % % si le moteur n'est pas en butee ce n'est pas normal.. |
---|
2365 | % if ~isequal(tango_command_inout(dev,'AxisGetMotionStatus'),-1) |
---|
2366 | % % probleme ! |
---|
2367 | % errordlg('bizzare, vous n''etes pas en butï¿œe...?!','Erreur'); |
---|
2368 | |
---|
2369 | % indiquer la butee haute sur moteur 1 (lentille haute) |
---|
2370 | set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
2371 | |
---|
2372 | % definir la position 0 |
---|
2373 | tango_command_inout(dev,'AxisDefinePosition',0); |
---|
2374 | % on affiche la position de la lentille |
---|
2375 | pos1=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
2376 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2377 | |
---|
2378 | % avancer du nombre de pas exact correspondant au grandissement max : |
---|
2379 | tango_command_inout(dev,'AxisGoToPosition',posl1Gmax); |
---|
2380 | % eteindre le voyant butï¿œe haute |
---|
2381 | set(handles.LHBH_edit25,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2382 | |
---|
2383 | % on attent que l'axe se mette en mouvement |
---|
2384 | %temporisation_mvt_axis(dev); |
---|
2385 | if (temporisation_mvt_axis(dev) == -1) |
---|
2386 | % abort |
---|
2387 | end |
---|
2388 | |
---|
2389 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2390 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
2391 | pause(0.2); |
---|
2392 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2393 | pause(0.2); |
---|
2394 | % on affiche la position de la lentille |
---|
2395 | pos1=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
2396 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2397 | % pause(0.2); |
---|
2398 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green') |
---|
2399 | % pause(0.2); |
---|
2400 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]) |
---|
2401 | end |
---|
2402 | % on affiche la position de la lentille |
---|
2403 | pos1=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
2404 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2405 | %set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2406 | |
---|
2407 | |
---|
2408 | end |
---|
2409 | |
---|
2410 | dev=device_name.lentille_basse |
---|
2411 | |
---|
2412 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2413 | |
---|
2414 | if (tango_error == -1) |
---|
2415 | %- handle error |
---|
2416 | tango_print_error_stack; |
---|
2417 | return; |
---|
2418 | errordlg('erreur tango !','Erreur'); |
---|
2419 | |
---|
2420 | else |
---|
2421 | % cas ou l'axe n'est pas en butee backward (en haut) |
---|
2422 | % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens - |
---|
2423 | % errorstatus=4 limitswitch backward |
---|
2424 | |
---|
2425 | if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
2426 | |
---|
2427 | % si on est en butï¿œe basse forward on ï¿œteind le voyant |
---|
2428 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
2429 | set(handles.LBBB_edit27,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2430 | end |
---|
2431 | |
---|
2432 | % aller en butee haute backward |
---|
2433 | tango_command_inout(dev,'AxisBackward'); |
---|
2434 | |
---|
2435 | % on attent que l'axe se mette en mouvement |
---|
2436 | %temporisation_mvt_axis(dev); |
---|
2437 | if (temporisation_mvt_axis(dev) == -1) |
---|
2438 | % abort |
---|
2439 | end |
---|
2440 | |
---|
2441 | % attendre la fin de la commande |
---|
2442 | % set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
2443 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2444 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
2445 | pause(0.2); |
---|
2446 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2447 | pause(0.2); |
---|
2448 | % on affiche la position de la lentille |
---|
2449 | pos2=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
2450 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2451 | % pause(0.2); |
---|
2452 | % set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
2453 | % pause(0.2); |
---|
2454 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2455 | end |
---|
2456 | % on affiche la position de la lentille |
---|
2457 | pos2=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
2458 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2459 | %set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2460 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2461 | end |
---|
2462 | |
---|
2463 | % % si le moteur n'est pas en butee ce n'est pas normal.. |
---|
2464 | % if ~isequal(tango_command_inout(dev,'AxisGetMotionStatus'),-1) |
---|
2465 | % % probleme ! |
---|
2466 | % errordlg('bizzare, vous n''etes pas en butï¿œe...?!','Erreur'); |
---|
2467 | % else |
---|
2468 | |
---|
2469 | % definir la position 0 |
---|
2470 | tango_command_inout(dev,'AxisDefinePosition',0); |
---|
2471 | % on affiche la position de la lentille |
---|
2472 | pos2=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
2473 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2474 | |
---|
2475 | % eteindre le voyant rouge butee backward s'il est allumᅵ |
---|
2476 | set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2477 | |
---|
2478 | % avancer du nombre de pas exact correspondant au grandissement MAX ... |
---|
2479 | tango_command_inout(dev,'AxisGoToPosition',posl2Gmax); |
---|
2480 | |
---|
2481 | % on attent que l'axe se mette en mouvement |
---|
2482 | %temporisation_mvt_axis(dev); |
---|
2483 | if (temporisation_mvt_axis(dev) == -1) |
---|
2484 | % abort |
---|
2485 | end |
---|
2486 | |
---|
2487 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2488 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
2489 | pause(0.2); |
---|
2490 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2491 | pause(0.2); |
---|
2492 | % on affiche la position de la lentille |
---|
2493 | pos2=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
2494 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2495 | % pause(0.2); |
---|
2496 | % set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
2497 | % pause(0.2); |
---|
2498 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2499 | end |
---|
2500 | % on affiche la position de la lentille |
---|
2501 | pos2=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
2502 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2503 | % % ï¿œteindre le vert |
---|
2504 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2505 | |
---|
2506 | end |
---|
2507 | |
---|
2508 | % allumer le voyant Gmax en rouge |
---|
2509 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition') |
---|
2510 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition') |
---|
2511 | test1 = test_position(pos1.value(1),posl1Gmax,5); |
---|
2512 | test2 = test_position(pos2.value(1),posl2Gmax,5); |
---|
2513 | if test1 == 1&test2==1 |
---|
2514 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
2515 | end |
---|
2516 | |
---|
2517 | %__________________________________________________________________________ |
---|
2518 | % --- Executes on button press in ppp_pushbutton18. |
---|
2519 | function ppp_pushbutton18_Callback(hObject, eventdata, handles) |
---|
2520 | % hObject handle to ppp_pushbutton18 (see GCBO) |
---|
2521 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2522 | % handles structure with handles and user data (see GUIDATA) |
---|
2523 | |
---|
2524 | logdev1=get(handles.Lenthaute_radiobutton7,'Value'); |
---|
2525 | logdev2=get(handles.tata_radiobutton10,'Value'); |
---|
2526 | posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
2527 | posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
2528 | posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
2529 | posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
2530 | posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
2531 | posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
2532 | device_name = getappdata(handles.figure1,'device_name'); |
---|
2533 | |
---|
2534 | if isequal(logdev1,0)&isequal(logdev2,0) |
---|
2535 | errordlg('selectionnez une lentille','ATTENTION'); |
---|
2536 | else |
---|
2537 | if isequal(logdev1,1) |
---|
2538 | dev=device_name.lentille_haute; |
---|
2539 | nbpas=5000; |
---|
2540 | else |
---|
2541 | dev=device_name.lentille_basse; |
---|
2542 | nbpas=10000; |
---|
2543 | end |
---|
2544 | |
---|
2545 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2546 | |
---|
2547 | if (tango_error == -1) |
---|
2548 | %- handle error |
---|
2549 | tango_print_error_stack; |
---|
2550 | return; |
---|
2551 | errordlg('erreur tango !','Erreur'); |
---|
2552 | |
---|
2553 | else |
---|
2554 | % cas ou l'axe n'est pas en butee forward (en bas) |
---|
2555 | % errorstatus=21 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
2556 | % errorstatus=3 limitswitch forward |
---|
2557 | |
---|
2558 | if ~isequal(errorstatus,21)&~isequal(errorstatus,3) |
---|
2559 | |
---|
2560 | % si on ï¿œtait en butï¿œe backward, on ï¿œteind le voyant |
---|
2561 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
2562 | if isequal(logdev1,1) |
---|
2563 | set(handles.LHBH_edit25,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2564 | else |
---|
2565 | set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2566 | end |
---|
2567 | end |
---|
2568 | |
---|
2569 | % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
2570 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2571 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2572 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2573 | |
---|
2574 | % on descend vers la butï¿œe forward |
---|
2575 | tango_command_inout(dev,'AxisGoToRelativePosition',nbpas); |
---|
2576 | |
---|
2577 | % temporisation : |
---|
2578 | %temporisation_mvt_axis(dev); |
---|
2579 | if (temporisation_mvt_axis(dev) == -1) |
---|
2580 | % abort |
---|
2581 | end |
---|
2582 | |
---|
2583 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2584 | |
---|
2585 | if isequal(logdev1,1) |
---|
2586 | |
---|
2587 | set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
2588 | % on affiche la position de la lentille |
---|
2589 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2590 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2591 | pause(0.2); |
---|
2592 | drawnow; |
---|
2593 | else |
---|
2594 | |
---|
2595 | set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
2596 | % on affiche la position de la lentille |
---|
2597 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2598 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2599 | pause(0.2); |
---|
2600 | drawnow; |
---|
2601 | |
---|
2602 | end |
---|
2603 | %pause(0.5); |
---|
2604 | end |
---|
2605 | |
---|
2606 | pause(0.5); |
---|
2607 | % on ᅵteind le vert ᅵ la fin du mouvement |
---|
2608 | % on ï¿œcrit une derniï¿œre fois la position de la lentille |
---|
2609 | if isequal(logdev1,1) |
---|
2610 | set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2611 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2612 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2613 | |
---|
2614 | else |
---|
2615 | set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2616 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2617 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2618 | end |
---|
2619 | |
---|
2620 | % si on est arrivᅵ en butᅵe forward on allume le voyant |
---|
2621 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2622 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
2623 | if isequal(logdev1,1) |
---|
2624 | set(handles.LHBB_edit24,'BackgroundColor','red'); |
---|
2625 | else |
---|
2626 | set(handles.LBBB_edit27,'BackgroundColor','red'); |
---|
2627 | end |
---|
2628 | end |
---|
2629 | |
---|
2630 | % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
2631 | |
---|
2632 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2633 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2634 | if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
2635 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
2636 | elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
2637 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
2638 | elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
2639 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
2640 | end |
---|
2641 | |
---|
2642 | else |
---|
2643 | errordlg('dᅵjᅵ en butee ou erreur','ATTENTION'); |
---|
2644 | end |
---|
2645 | end |
---|
2646 | end |
---|
2647 | |
---|
2648 | % |
---|
2649 | % |
---|
2650 | % logdev1=get(handles.Lenthaute_radiobutton7,'Value'); |
---|
2651 | % logdev2=get(handles.tata_radiobutton10,'Value'); |
---|
2652 | % posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
2653 | % posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
2654 | % posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
2655 | % posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
2656 | % posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
2657 | % posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
2658 | % |
---|
2659 | % if isequal(logdev1,0)&isequal(logdev2,0) |
---|
2660 | % errordlg('selectionnez une lentille','ATTENTION'); |
---|
2661 | % else |
---|
2662 | % if isequal(logdev1,1) |
---|
2663 | % dev=device_name.lentille_haute; |
---|
2664 | % nbpas=5000; |
---|
2665 | % else |
---|
2666 | % dev=device_name.lentille_basse; |
---|
2667 | % nbpas=10000; |
---|
2668 | % end |
---|
2669 | % |
---|
2670 | % errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2671 | % |
---|
2672 | % if (tango_error == -1) |
---|
2673 | % %- handle error |
---|
2674 | % tango_print_error_stack; |
---|
2675 | % return; |
---|
2676 | % errordlg('erreur tango !','Erreur'); |
---|
2677 | % |
---|
2678 | % else |
---|
2679 | % % cas ou l'axe n'est pas en butee forward (en bas) |
---|
2680 | % % errorstatus=21 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
2681 | % % errorstatus=3 limitswitch forward |
---|
2682 | % |
---|
2683 | % if ~isequal(errorstatus,21)&~isequal(errorstatus,3) |
---|
2684 | % |
---|
2685 | % % si on ï¿œtait en butï¿œe backward, on ï¿œteind le voyant |
---|
2686 | % if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
2687 | % if isequal(logdev1,1) |
---|
2688 | % set(handles.LHBH_edit25,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2689 | % else |
---|
2690 | % set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2691 | % end |
---|
2692 | % end |
---|
2693 | % |
---|
2694 | % % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
2695 | % set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2696 | % set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2697 | % set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2698 | % |
---|
2699 | % |
---|
2700 | % % on descend vers la butï¿œe forward |
---|
2701 | % tango_command_inout(dev,'AxisGoToRelativePosition',nbpas); |
---|
2702 | % |
---|
2703 | % % temporisation : |
---|
2704 | % pause(0.2); |
---|
2705 | % while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2706 | % if isequal(logdev1,1) |
---|
2707 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
2708 | % else |
---|
2709 | % set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
2710 | % end |
---|
2711 | % pause(0.5); |
---|
2712 | % end |
---|
2713 | % |
---|
2714 | % % on ᅵteind le vert ᅵ la fin du mouvement |
---|
2715 | % if isequal(logdev1,1) |
---|
2716 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2717 | % else |
---|
2718 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2719 | % end |
---|
2720 | % |
---|
2721 | % % si on est arrivᅵ en butᅵe forward on allume le voyant |
---|
2722 | % errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2723 | % if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
2724 | % if isequal(logdev1,1) |
---|
2725 | % set(handles.LHBB_edit24,'BackgroundColor','red'); |
---|
2726 | % else |
---|
2727 | % set(handles.LBBB_edit27,'BackgroundColor','red'); |
---|
2728 | % end |
---|
2729 | % end |
---|
2730 | % |
---|
2731 | % % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
2732 | % |
---|
2733 | % pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2734 | % pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2735 | % if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
2736 | % set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
2737 | % elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
2738 | % set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
2739 | % elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
2740 | % set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
2741 | % end |
---|
2742 | % |
---|
2743 | % else |
---|
2744 | % errordlg('dᅵjᅵ en butee ou erreur','ATTENTION'); |
---|
2745 | % end |
---|
2746 | % end |
---|
2747 | % end |
---|
2748 | % |
---|
2749 | |
---|
2750 | |
---|
2751 | |
---|
2752 | % --- Executes on button press in pp_pushbutton19. |
---|
2753 | function pp_pushbutton19_Callback(hObject, eventdata, handles) |
---|
2754 | % hObject handle to pp_pushbutton19 (see GCBO) |
---|
2755 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2756 | % handles structure with handles and user data (see GUIDATA) |
---|
2757 | |
---|
2758 | logdev1=get(handles.Lenthaute_radiobutton7,'Value'); |
---|
2759 | logdev2=get(handles.tata_radiobutton10,'Value'); |
---|
2760 | posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
2761 | posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
2762 | posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
2763 | posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
2764 | posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
2765 | posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
2766 | device_name = getappdata(handles.figure1,'device_name'); |
---|
2767 | |
---|
2768 | if isequal(logdev1,0)&isequal(logdev2,0) |
---|
2769 | errordlg('selectionnez une lentille','ATTENTION'); |
---|
2770 | else |
---|
2771 | if isequal(logdev1,1) |
---|
2772 | dev=device_name.lentille_haute; |
---|
2773 | nbpas=500; |
---|
2774 | else |
---|
2775 | dev=device_name.lentille_basse; |
---|
2776 | nbpas=1000; |
---|
2777 | end |
---|
2778 | |
---|
2779 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2780 | |
---|
2781 | if (tango_error == -1) |
---|
2782 | %- handle error |
---|
2783 | tango_print_error_stack; |
---|
2784 | return; |
---|
2785 | errordlg('erreur tango !','Erreur'); |
---|
2786 | |
---|
2787 | else |
---|
2788 | % cas ou l'axe n'est pas en butee forward (en bas) |
---|
2789 | % errorstatus=21 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
2790 | % errorstatus=3 limitswitch forward |
---|
2791 | |
---|
2792 | if ~isequal(errorstatus,21)&~isequal(errorstatus,3) |
---|
2793 | |
---|
2794 | % si on ï¿œtait en butï¿œe backward, on ï¿œteind le voyant |
---|
2795 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
2796 | if isequal(logdev1,1) |
---|
2797 | set(handles.LHBH_edit25,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2798 | else |
---|
2799 | set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2800 | end |
---|
2801 | end |
---|
2802 | |
---|
2803 | % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
2804 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2805 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2806 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2807 | |
---|
2808 | % on descend vers la butï¿œe forward |
---|
2809 | tango_command_inout(dev,'AxisGoToRelativePosition',nbpas); |
---|
2810 | |
---|
2811 | % temporisation : |
---|
2812 | %temporisation_mvt_axis(dev); |
---|
2813 | if (temporisation_mvt_axis(dev) == -1) |
---|
2814 | % abort |
---|
2815 | end |
---|
2816 | |
---|
2817 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2818 | |
---|
2819 | if isequal(logdev1,1) |
---|
2820 | |
---|
2821 | set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
2822 | % on affiche la position de la lentille |
---|
2823 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2824 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2825 | pause(0.2); |
---|
2826 | drawnow; |
---|
2827 | else |
---|
2828 | |
---|
2829 | set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
2830 | % on affiche la position de la lentille |
---|
2831 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2832 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2833 | pause(0.2); |
---|
2834 | drawnow; |
---|
2835 | |
---|
2836 | end |
---|
2837 | %pause(0.5); |
---|
2838 | end |
---|
2839 | |
---|
2840 | pause(0.5); |
---|
2841 | % on ᅵteind le vert ᅵ la fin du mouvement |
---|
2842 | % on ï¿œcrit une derniï¿œre fois la position de la lentille |
---|
2843 | if isequal(logdev1,1) |
---|
2844 | set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2845 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2846 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2847 | |
---|
2848 | else |
---|
2849 | set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2850 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2851 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2852 | end |
---|
2853 | |
---|
2854 | % si on est arrivᅵ en butᅵe forward on allume le voyant |
---|
2855 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2856 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
2857 | if isequal(logdev1,1) |
---|
2858 | set(handles.LHBB_edit24,'BackgroundColor','red'); |
---|
2859 | else |
---|
2860 | set(handles.LBBB_edit27,'BackgroundColor','red'); |
---|
2861 | end |
---|
2862 | end |
---|
2863 | |
---|
2864 | % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
2865 | |
---|
2866 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2867 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2868 | if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
2869 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
2870 | elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
2871 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
2872 | elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
2873 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
2874 | end |
---|
2875 | |
---|
2876 | else |
---|
2877 | errordlg('dᅵjᅵ en butee ou erreur','ATTENTION'); |
---|
2878 | end |
---|
2879 | end |
---|
2880 | end |
---|
2881 | |
---|
2882 | |
---|
2883 | |
---|
2884 | |
---|
2885 | % --- Executes on button press in p_pushbutton20. |
---|
2886 | function p_pushbutton20_Callback(hObject, eventdata, handles) |
---|
2887 | % hObject handle to p_pushbutton20 (see GCBO) |
---|
2888 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2889 | % handles structure with handles and user data (see GUIDATA) |
---|
2890 | |
---|
2891 | logdev1=get(handles.Lenthaute_radiobutton7,'Value'); |
---|
2892 | logdev2=get(handles.tata_radiobutton10,'Value'); |
---|
2893 | posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
2894 | posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
2895 | posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
2896 | posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
2897 | posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
2898 | posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
2899 | device_name = getappdata(handles.figure1,'device_name'); |
---|
2900 | |
---|
2901 | if isequal(logdev1,0)&isequal(logdev2,0) |
---|
2902 | errordlg('selectionnez une lentille','ATTENTION'); |
---|
2903 | else |
---|
2904 | if isequal(logdev1,1) |
---|
2905 | dev=device_name.lentille_haute; |
---|
2906 | nbpas=50; |
---|
2907 | else |
---|
2908 | dev=device_name.lentille_basse; |
---|
2909 | nbpas=100; |
---|
2910 | end |
---|
2911 | |
---|
2912 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2913 | |
---|
2914 | if (tango_error == -1) |
---|
2915 | %- handle error |
---|
2916 | tango_print_error_stack; |
---|
2917 | return; |
---|
2918 | errordlg('erreur tango !','Erreur'); |
---|
2919 | |
---|
2920 | else |
---|
2921 | % cas ou l'axe n'est pas en butee forward (en bas) |
---|
2922 | % errorstatus=21 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
2923 | % errorstatus=3 limitswitch forward |
---|
2924 | |
---|
2925 | if ~isequal(errorstatus,21)&~isequal(errorstatus,3) |
---|
2926 | |
---|
2927 | % si on ï¿œtait en butï¿œe backward, on ï¿œteind le voyant |
---|
2928 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
2929 | if isequal(logdev1,1) |
---|
2930 | set(handles.LHBH_edit25,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2931 | else |
---|
2932 | set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2933 | end |
---|
2934 | end |
---|
2935 | |
---|
2936 | % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
2937 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2938 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2939 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
2940 | |
---|
2941 | |
---|
2942 | % on descend vers la butï¿œe forward |
---|
2943 | tango_command_inout(dev,'AxisGoToRelativePosition',nbpas); |
---|
2944 | |
---|
2945 | % temporisation : |
---|
2946 | %temporisation_mvt_axis(dev); |
---|
2947 | if (temporisation_mvt_axis(dev) == -1) |
---|
2948 | % abort |
---|
2949 | end |
---|
2950 | |
---|
2951 | %pause(0.2); |
---|
2952 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
2953 | if isequal(logdev1,1) |
---|
2954 | set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
2955 | % on affiche la position de la lentille |
---|
2956 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2957 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2958 | else |
---|
2959 | set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
2960 | % on affiche la position de la lentille |
---|
2961 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2962 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2963 | end |
---|
2964 | |
---|
2965 | end |
---|
2966 | |
---|
2967 | pause(0.5); |
---|
2968 | % on ᅵteind le vert ᅵ la fin du mouvement |
---|
2969 | % on ï¿œcrit une derniï¿œre fois la position de la lentille |
---|
2970 | |
---|
2971 | if isequal(logdev1,1) |
---|
2972 | set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2973 | % on affiche la position de la lentille |
---|
2974 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
2975 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
2976 | |
---|
2977 | else |
---|
2978 | set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
2979 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
2980 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
2981 | |
---|
2982 | end |
---|
2983 | |
---|
2984 | % si on est arrivᅵ en butᅵe forward on allume le voyant |
---|
2985 | |
---|
2986 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
2987 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
2988 | if isequal(logdev1,1) |
---|
2989 | set(handles.LHBB_edit24,'BackgroundColor','red'); |
---|
2990 | |
---|
2991 | else |
---|
2992 | set(handles.LBBB_edit27,'BackgroundColor','red'); |
---|
2993 | |
---|
2994 | end |
---|
2995 | end |
---|
2996 | |
---|
2997 | % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
2998 | |
---|
2999 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3000 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3001 | if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
3002 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
3003 | elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
3004 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
3005 | elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
3006 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
3007 | end |
---|
3008 | |
---|
3009 | else |
---|
3010 | errordlg('dᅵjᅵ en butee ou erreur','ATTENTION'); |
---|
3011 | end |
---|
3012 | end |
---|
3013 | end |
---|
3014 | |
---|
3015 | % --- Executes on button press in m_pushbutton23. |
---|
3016 | function mmm_pushbutton21_Callback(hObject, eventdata, handles) |
---|
3017 | % hObject handle to m_pushbutton23 (see GCBO) |
---|
3018 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3019 | % handles structure with handles and user data (see GUIDATA) |
---|
3020 | |
---|
3021 | logdev1=get(handles.Lenthaute_radiobutton7,'Value'); |
---|
3022 | logdev2=get(handles.tata_radiobutton10,'Value'); |
---|
3023 | posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
3024 | posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
3025 | posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
3026 | posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
3027 | posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
3028 | posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
3029 | device_name = getappdata(handles.figure1,'device_name'); |
---|
3030 | |
---|
3031 | if isequal(logdev1,0)&isequal(logdev2,0) |
---|
3032 | errordlg('selectionnez une lentille','ATTENTION'); |
---|
3033 | else |
---|
3034 | if isequal(logdev1,1) |
---|
3035 | dev=device_name.lentille_haute; |
---|
3036 | nbpas=-5000; |
---|
3037 | else |
---|
3038 | dev=device_name.lentille_basse; |
---|
3039 | nbpas=-10000; |
---|
3040 | end |
---|
3041 | |
---|
3042 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
3043 | |
---|
3044 | if (tango_error == -1) |
---|
3045 | %- handle error |
---|
3046 | tango_print_error_stack; |
---|
3047 | return; |
---|
3048 | errordlg('erreur tango !','Erreur'); |
---|
3049 | |
---|
3050 | else |
---|
3051 | % cas ou l'axe n'est pas en butee backward (en haut) |
---|
3052 | % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
3053 | % errorstatus=4 limitswitch forward |
---|
3054 | |
---|
3055 | if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
3056 | |
---|
3057 | % si on ï¿œtait en butï¿œe forward, on ï¿œteind le voyant |
---|
3058 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
3059 | if isequal(logdev1,1) |
---|
3060 | set(handles.LHBB_edit24,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3061 | else |
---|
3062 | set(handles.LBBB_edit27,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3063 | end |
---|
3064 | end |
---|
3065 | |
---|
3066 | % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
3067 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3068 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3069 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3070 | |
---|
3071 | |
---|
3072 | % on monte vers la butï¿œe backward |
---|
3073 | tango_command_inout(dev,'AxisGoToRelativePosition',nbpas); |
---|
3074 | if (tango_error == -1) |
---|
3075 | %- handle error |
---|
3076 | tango_print_error_stack; |
---|
3077 | return; |
---|
3078 | errordlg('erreur tango !','Erreur'); |
---|
3079 | |
---|
3080 | else |
---|
3081 | |
---|
3082 | % temporisation : |
---|
3083 | %temporisation_mvt_axis(dev); |
---|
3084 | if (temporisation_mvt_axis(dev) == -1) |
---|
3085 | % abort |
---|
3086 | end |
---|
3087 | |
---|
3088 | if isequal(logdev1,1) |
---|
3089 | |
---|
3090 | set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
3091 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
3092 | % on affiche la position de la lentille |
---|
3093 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3094 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
3095 | pause(0.2); |
---|
3096 | drawnow; |
---|
3097 | end |
---|
3098 | |
---|
3099 | else |
---|
3100 | |
---|
3101 | set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
3102 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
3103 | % on affiche la position de la lentille |
---|
3104 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3105 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
3106 | pause(0.2); |
---|
3107 | drawnow; |
---|
3108 | end |
---|
3109 | |
---|
3110 | end |
---|
3111 | % while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
3112 | % disp('dans la boucle tant que mvt') |
---|
3113 | % if isequal(logdev1,1) |
---|
3114 | % disp('je dois afficher le vert') |
---|
3115 | % pause(0.1); |
---|
3116 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
3117 | % % on affiche la position de la lentille |
---|
3118 | % pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3119 | % %pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3120 | % set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
3121 | % %set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
3122 | % else |
---|
3123 | % set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
3124 | % % on affiche la position de la lentille |
---|
3125 | % %pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3126 | % pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3127 | % %set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
3128 | % set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
3129 | % |
---|
3130 | % end |
---|
3131 | % end |
---|
3132 | |
---|
3133 | pause(0.5); |
---|
3134 | % on ᅵteind le vert ᅵ la fin du mouvement |
---|
3135 | % on ï¿œcrit une derniï¿œre fois la position de la lentille |
---|
3136 | |
---|
3137 | if isequal(logdev1,1) |
---|
3138 | set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3139 | % on affiche la position de la lentille |
---|
3140 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3141 | %pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3142 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
3143 | %set(handles.pos2_edit30,'String',num2str(pos2.value(1) |
---|
3144 | %)); |
---|
3145 | |
---|
3146 | else |
---|
3147 | set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3148 | %pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3149 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3150 | %set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
3151 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
3152 | |
---|
3153 | end |
---|
3154 | |
---|
3155 | % si on est arrivᅵ en butᅵe backward on allume le voyant |
---|
3156 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
3157 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
3158 | if isequal(logdev1,1) |
---|
3159 | set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
3160 | else |
---|
3161 | set(handles.LBBH_edit26,'BackgroundColor','red'); |
---|
3162 | end |
---|
3163 | end |
---|
3164 | |
---|
3165 | % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
3166 | |
---|
3167 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3168 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3169 | if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
3170 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
3171 | elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
3172 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
3173 | elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
3174 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
3175 | end |
---|
3176 | end |
---|
3177 | else |
---|
3178 | errordlg('dᅵjᅵ en butee ou erreur','ATTENTION'); |
---|
3179 | end |
---|
3180 | end |
---|
3181 | end |
---|
3182 | |
---|
3183 | |
---|
3184 | |
---|
3185 | |
---|
3186 | % % --- Executes on button press in mmm_pushbutton21. |
---|
3187 | % function mmm_pushbutton21_Callback(hObject, eventdata, handles) |
---|
3188 | % % hObject handle to mmm_pushbutton21 (see GCBO) |
---|
3189 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
3190 | % % handles structure with handles and user data (see GUIDATA) |
---|
3191 | % |
---|
3192 | % logdev1=get(handles.Lenthaute_radiobutton7,'Value'); |
---|
3193 | % logdev2=get(handles.tata_radiobutton10,'Value'); |
---|
3194 | % posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
3195 | % posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
3196 | % posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
3197 | % posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
3198 | % posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
3199 | % posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
3200 | % |
---|
3201 | % if isequal(logdev1,0)&isequal(logdev2,0) |
---|
3202 | % errordlg('selectionnez une lentille','ATTENTION'); |
---|
3203 | % else |
---|
3204 | % if isequal(logdev1,1) |
---|
3205 | % dev=device_name.lentille_haute; |
---|
3206 | % nbpas=-5000; |
---|
3207 | % else |
---|
3208 | % dev=device_name.lentille_basse; |
---|
3209 | % nbpas=-10000; |
---|
3210 | % end |
---|
3211 | % |
---|
3212 | % errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
3213 | % |
---|
3214 | % if (tango_error == -1) |
---|
3215 | % %- handle error |
---|
3216 | % tango_print_error_stack; |
---|
3217 | % return; |
---|
3218 | % errordlg('erreur tango !','Erreur'); |
---|
3219 | % |
---|
3220 | % else |
---|
3221 | % % cas ou l'axe n'est pas en butee backward (en haut) |
---|
3222 | % % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
3223 | % % errorstatus=4 limitswitch forward |
---|
3224 | % |
---|
3225 | % if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
3226 | % |
---|
3227 | % % si on ï¿œtait en butï¿œe forward, on ï¿œteind le voyant |
---|
3228 | % if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
3229 | % if isequal(logdev1,1) |
---|
3230 | % set(handles.LHBB_edit24,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3231 | % else |
---|
3232 | % set(handles.LBBB_edit27,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3233 | % end |
---|
3234 | % end |
---|
3235 | % |
---|
3236 | % % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
3237 | % set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3238 | % set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3239 | % set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3240 | % |
---|
3241 | % % on monte vers la butï¿œe backward |
---|
3242 | % tango_command_inout(dev,'AxisGoToRelativePosition',nbpas); |
---|
3243 | % |
---|
3244 | % % temporisation : |
---|
3245 | % pause(0.2); |
---|
3246 | % while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
3247 | % if isequal(logdev1,1) |
---|
3248 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
3249 | % else |
---|
3250 | % set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
3251 | % end |
---|
3252 | % pause(0.5); |
---|
3253 | % end |
---|
3254 | % |
---|
3255 | % % on ᅵteind le vert ᅵ la fin du mouvement |
---|
3256 | % if isequal(logdev1,1) |
---|
3257 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3258 | % else |
---|
3259 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3260 | % end |
---|
3261 | % |
---|
3262 | % % si on est arrivᅵ en butᅵe backward on allume le voyant |
---|
3263 | % errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
3264 | % if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
3265 | % if isequal(logdev1,1) |
---|
3266 | % set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
3267 | % else |
---|
3268 | % set(handles.LBBH_edit26,'BackgroundColor','red'); |
---|
3269 | % end |
---|
3270 | % end |
---|
3271 | % |
---|
3272 | % % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
3273 | % |
---|
3274 | % pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3275 | % pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3276 | % if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
3277 | % set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
3278 | % elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
3279 | % set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
3280 | % elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
3281 | % set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
3282 | % end |
---|
3283 | % |
---|
3284 | % |
---|
3285 | % else |
---|
3286 | % errordlg('dᅵjᅵ en butee ou erreur','ATTENTION'); |
---|
3287 | % end |
---|
3288 | % end |
---|
3289 | % end |
---|
3290 | |
---|
3291 | % --- Executes on button press in m_pushbutton23. |
---|
3292 | function mm_pushbutton22_Callback(hObject, eventdata, handles) |
---|
3293 | % hObject handle to m_pushbutton23 (see GCBO) |
---|
3294 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3295 | % handles structure with handles and user data (see GUIDATA) |
---|
3296 | |
---|
3297 | logdev1=get(handles.Lenthaute_radiobutton7,'Value'); |
---|
3298 | logdev2=get(handles.tata_radiobutton10,'Value'); |
---|
3299 | posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
3300 | posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
3301 | posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
3302 | posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
3303 | posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
3304 | posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
3305 | device_name = getappdata(handles.figure1,'device_name'); |
---|
3306 | |
---|
3307 | if isequal(logdev1,0)&isequal(logdev2,0) |
---|
3308 | errordlg('selectionnez une lentille','ATTENTION'); |
---|
3309 | else |
---|
3310 | if isequal(logdev1,1) |
---|
3311 | dev=device_name.lentille_haute; |
---|
3312 | nbpas=-500; |
---|
3313 | else |
---|
3314 | dev=device_name.lentille_basse; |
---|
3315 | nbpas=-1000; |
---|
3316 | end |
---|
3317 | |
---|
3318 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
3319 | |
---|
3320 | if (tango_error == -1) |
---|
3321 | %- handle error |
---|
3322 | tango_print_error_stack; |
---|
3323 | return; |
---|
3324 | errordlg('erreur tango !','Erreur'); |
---|
3325 | |
---|
3326 | else |
---|
3327 | % cas ou l'axe n'est pas en butee backward (en haut) |
---|
3328 | % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
3329 | % errorstatus=4 limitswitch forward |
---|
3330 | |
---|
3331 | if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
3332 | |
---|
3333 | % si on ï¿œtait en butï¿œe forward, on ï¿œteind le voyant |
---|
3334 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
3335 | if isequal(logdev1,1) |
---|
3336 | set(handles.LHBB_edit24,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3337 | else |
---|
3338 | set(handles.LBBB_edit27,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3339 | end |
---|
3340 | end |
---|
3341 | |
---|
3342 | % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
3343 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3344 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3345 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3346 | |
---|
3347 | |
---|
3348 | % on monte vers la butï¿œe backward |
---|
3349 | tango_command_inout(dev,'AxisGoToRelativePosition',nbpas); |
---|
3350 | if (tango_error == -1) |
---|
3351 | %- handle error |
---|
3352 | tango_print_error_stack; |
---|
3353 | return; |
---|
3354 | errordlg('erreur tango !','Erreur'); |
---|
3355 | |
---|
3356 | else |
---|
3357 | |
---|
3358 | % temporisation : |
---|
3359 | %temporisation_mvt_axis(dev); |
---|
3360 | if (temporisation_mvt_axis(dev) == -1) |
---|
3361 | % abort |
---|
3362 | end |
---|
3363 | |
---|
3364 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
3365 | |
---|
3366 | if isequal(logdev1,1) |
---|
3367 | set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
3368 | % on affiche la position de la lentille |
---|
3369 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3370 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
3371 | pause(0.2); |
---|
3372 | drawnow; |
---|
3373 | |
---|
3374 | else |
---|
3375 | |
---|
3376 | set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
3377 | % on affiche la position de la lentille |
---|
3378 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3379 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
3380 | pause(0.2); |
---|
3381 | drawnow; |
---|
3382 | |
---|
3383 | end |
---|
3384 | end |
---|
3385 | |
---|
3386 | pause(0.5); |
---|
3387 | % on ᅵteind le vert ᅵ la fin du mouvement |
---|
3388 | % on ï¿œcrit une derniï¿œre fois la position de la lentille |
---|
3389 | |
---|
3390 | if isequal(logdev1,1) |
---|
3391 | set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3392 | % on affiche la position de la lentille |
---|
3393 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3394 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
3395 | |
---|
3396 | else |
---|
3397 | set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3398 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3399 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
3400 | |
---|
3401 | end |
---|
3402 | |
---|
3403 | % si on est arrivᅵ en butᅵe backward on allume le voyant |
---|
3404 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
3405 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
3406 | if isequal(logdev1,1) |
---|
3407 | set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
3408 | else |
---|
3409 | set(handles.LBBH_edit26,'BackgroundColor','red'); |
---|
3410 | end |
---|
3411 | end |
---|
3412 | |
---|
3413 | % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
3414 | |
---|
3415 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3416 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3417 | if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
3418 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
3419 | elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
3420 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
3421 | elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
3422 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
3423 | end |
---|
3424 | end |
---|
3425 | else |
---|
3426 | errordlg('dᅵjᅵ en butee ou erreur','ATTENTION'); |
---|
3427 | end |
---|
3428 | end |
---|
3429 | end |
---|
3430 | |
---|
3431 | % |
---|
3432 | % |
---|
3433 | % % --- Executes on button press in mm_pushbutton22. |
---|
3434 | % function mm_pushbutton22_Callback(hObject, eventdata, handles) |
---|
3435 | % % hObject handle to mm_pushbutton22 (see GCBO) |
---|
3436 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
3437 | % % handles structure with handles and user data (see GUIDATA) |
---|
3438 | % |
---|
3439 | % |
---|
3440 | % logdev1=get(handles.Lenthaute_radiobutton7,'Value'); |
---|
3441 | % logdev2=get(handles.tata_radiobutton10,'Value'); |
---|
3442 | % posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
3443 | % posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
3444 | % posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
3445 | % posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
3446 | % posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
3447 | % posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
3448 | % |
---|
3449 | % if isequal(logdev1,0)&isequal(logdev2,0) |
---|
3450 | % errordlg('selectionnez une lentille','ATTENTION'); |
---|
3451 | % else |
---|
3452 | % if isequal(logdev1,1) |
---|
3453 | % dev=device_name.lentille_haute; |
---|
3454 | % nbpas=-500; |
---|
3455 | % else |
---|
3456 | % dev=device_name.lentille_basse; |
---|
3457 | % nbpas=-1000; |
---|
3458 | % end |
---|
3459 | % |
---|
3460 | % errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
3461 | % |
---|
3462 | % if (tango_error == -1) |
---|
3463 | % %- handle error |
---|
3464 | % tango_print_error_stack; |
---|
3465 | % return; |
---|
3466 | % errordlg('erreur tango !','Erreur'); |
---|
3467 | % |
---|
3468 | % else |
---|
3469 | % % cas ou l'axe n'est pas en butee backward (en haut) |
---|
3470 | % % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
3471 | % % errorstatus=4 limitswitch forward |
---|
3472 | % |
---|
3473 | % if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
3474 | % |
---|
3475 | % % si on ï¿œtait en butï¿œe forward, on ï¿œteind le voyant |
---|
3476 | % if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
3477 | % if isequal(logdev1,1) |
---|
3478 | % set(handles.LHBB_edit24,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3479 | % else |
---|
3480 | % set(handles.LBBB_edit27,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3481 | % end |
---|
3482 | % end |
---|
3483 | % |
---|
3484 | % % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
3485 | % set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3486 | % set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3487 | % set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3488 | % |
---|
3489 | % % on monte vers la butï¿œe backward |
---|
3490 | % tango_command_inout(dev,'AxisGoToRelativePosition',nbpas); |
---|
3491 | % if (tango_error == -1) |
---|
3492 | % %- handle error |
---|
3493 | % tango_print_error_stack; |
---|
3494 | % return; |
---|
3495 | % errordlg('erreur tango !','Erreur'); |
---|
3496 | % |
---|
3497 | % else |
---|
3498 | % |
---|
3499 | % % temporisation : |
---|
3500 | % pause(0.2); |
---|
3501 | % while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
3502 | % if isequal(logdev1,1) |
---|
3503 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
3504 | % else |
---|
3505 | % set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
3506 | % end |
---|
3507 | % pause(0.5); |
---|
3508 | % end |
---|
3509 | % |
---|
3510 | % % on ᅵteind le vert ᅵ la fin du mouvement |
---|
3511 | % if isequal(logdev1,1) |
---|
3512 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3513 | % else |
---|
3514 | % set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3515 | % end |
---|
3516 | % |
---|
3517 | % % si on est arrivᅵ en butᅵe backward on allume le voyant |
---|
3518 | % errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
3519 | % if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
3520 | % if isequal(logdev1,1) |
---|
3521 | % set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
3522 | % else |
---|
3523 | % set(handles.LBBH_edit26,'BackgroundColor','red'); |
---|
3524 | % end |
---|
3525 | % end |
---|
3526 | % |
---|
3527 | % % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
3528 | % |
---|
3529 | % pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3530 | % pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3531 | % if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
3532 | % set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
3533 | % elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
3534 | % set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
3535 | % elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
3536 | % set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
3537 | % end |
---|
3538 | % |
---|
3539 | % end |
---|
3540 | % else |
---|
3541 | % errordlg('dᅵjᅵ en butee ou erreur','ATTENTION'); |
---|
3542 | % end |
---|
3543 | % end |
---|
3544 | % end |
---|
3545 | |
---|
3546 | |
---|
3547 | % --- Executes on button press in m_pushbutton23. |
---|
3548 | function m_pushbutton23_Callback(hObject, eventdata, handles) |
---|
3549 | % hObject handle to m_pushbutton23 (see GCBO) |
---|
3550 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3551 | % handles structure with handles and user data (see GUIDATA) |
---|
3552 | |
---|
3553 | logdev1=get(handles.Lenthaute_radiobutton7,'Value'); |
---|
3554 | logdev2=get(handles.tata_radiobutton10,'Value'); |
---|
3555 | posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
3556 | posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
3557 | posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
3558 | posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
3559 | posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
3560 | posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
3561 | device_name = getappdata(handles.figure1,'device_name'); |
---|
3562 | |
---|
3563 | if isequal(logdev1,0)&isequal(logdev2,0) |
---|
3564 | errordlg('selectionnez une lentille','ATTENTION'); |
---|
3565 | else |
---|
3566 | if isequal(logdev1,1) |
---|
3567 | dev=device_name.lentille_haute; |
---|
3568 | nbpas=-50; |
---|
3569 | else |
---|
3570 | dev=device_name.lentille_basse; |
---|
3571 | nbpas=-100; |
---|
3572 | end |
---|
3573 | |
---|
3574 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
3575 | |
---|
3576 | if (tango_error == -1) |
---|
3577 | %- handle error |
---|
3578 | tango_print_error_stack; |
---|
3579 | return; |
---|
3580 | errordlg('erreur tango !','Erreur'); |
---|
3581 | |
---|
3582 | else |
---|
3583 | % cas ou l'axe n'est pas en butee backward (en haut) |
---|
3584 | % errorstatus=22 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
3585 | % errorstatus=4 limitswitch forward |
---|
3586 | |
---|
3587 | if ~isequal(errorstatus,22)&~isequal(errorstatus,4) |
---|
3588 | |
---|
3589 | % si on ï¿œtait en butï¿œe forward, on ï¿œteind le voyant |
---|
3590 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
3591 | if isequal(logdev1,1) |
---|
3592 | set(handles.LHBB_edit24,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3593 | else |
---|
3594 | set(handles.LBBB_edit27,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3595 | end |
---|
3596 | end |
---|
3597 | |
---|
3598 | % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
3599 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3600 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3601 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
3602 | |
---|
3603 | |
---|
3604 | % on monte vers la butï¿œe backward |
---|
3605 | tango_command_inout(dev,'AxisGoToRelativePosition',nbpas); |
---|
3606 | if (tango_error == -1) |
---|
3607 | %- handle error |
---|
3608 | tango_print_error_stack; |
---|
3609 | return; |
---|
3610 | errordlg('erreur tango !','Erreur'); |
---|
3611 | |
---|
3612 | else |
---|
3613 | |
---|
3614 | % temporisation : |
---|
3615 | %temporisation_mvt_axis(dev); |
---|
3616 | if (temporisation_mvt_axis(dev) == -1) |
---|
3617 | % abort |
---|
3618 | end |
---|
3619 | |
---|
3620 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
3621 | if isequal(logdev1,1) |
---|
3622 | set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
3623 | % on affiche la position de la lentille |
---|
3624 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3625 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
3626 | else |
---|
3627 | set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
3628 | % on affiche la position de la lentille |
---|
3629 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3630 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
3631 | |
---|
3632 | end |
---|
3633 | end |
---|
3634 | |
---|
3635 | pause(0.5); |
---|
3636 | % on ᅵteind le vert ᅵ la fin du mouvement |
---|
3637 | % on ï¿œcrit une derniï¿œre fois la position de la lentille |
---|
3638 | |
---|
3639 | if isequal(logdev1,1) |
---|
3640 | set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3641 | % on affiche la position de la lentille |
---|
3642 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3643 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
3644 | |
---|
3645 | else |
---|
3646 | set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
3647 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3648 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
3649 | |
---|
3650 | end |
---|
3651 | |
---|
3652 | % si on est arrivᅵ en butᅵe backward on allume le voyant |
---|
3653 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
3654 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
3655 | if isequal(logdev1,1) |
---|
3656 | set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
3657 | else |
---|
3658 | set(handles.LBBH_edit26,'BackgroundColor','red'); |
---|
3659 | end |
---|
3660 | end |
---|
3661 | |
---|
3662 | % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
3663 | |
---|
3664 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
3665 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
3666 | if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
3667 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
3668 | elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
3669 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
3670 | elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
3671 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
3672 | end |
---|
3673 | end |
---|
3674 | else |
---|
3675 | errordlg('dᅵjᅵ en butee ou erreur','ATTENTION'); |
---|
3676 | end |
---|
3677 | end |
---|
3678 | end |
---|
3679 | |
---|
3680 | |
---|
3681 | % % --- Executes on button press in backlight_pushbutton24. |
---|
3682 | % function backlight_pushbutton24_Callback(hObject, eventdata, handles) |
---|
3683 | % % hObject handle to backlight_pushbutton24 (see GCBO) |
---|
3684 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
3685 | % % handles structure with handles and user data (see GUIDATA) |
---|
3686 | % |
---|
3687 | % prompt={'entrer une intensitᅵ * entier entre 0 et 10'}; |
---|
3688 | % name='backlight'; |
---|
3689 | % numlines=1; |
---|
3690 | % lumiere=tango_command_inout('lt2/emit/backlight','GetBrightness'); |
---|
3691 | % %- check error |
---|
3692 | % if (tango_error == -1) |
---|
3693 | % %- handle error |
---|
3694 | % tango_print_error_stack; |
---|
3695 | % return; |
---|
3696 | % else |
---|
3697 | % defaultanswer={num2str(lumiere)}; |
---|
3698 | % end |
---|
3699 | % options.Resize='on'; |
---|
3700 | % options.WindowStyle='normal'; |
---|
3701 | % options.Interpreter='tex'; |
---|
3702 | % intensite=inputdlg(prompt,name,numlines,defaultanswer,options); |
---|
3703 | % if ~isempty(intensite) |
---|
3704 | % tango_command_inout('lt2/emit/backlight','SetBrightness',uint16(str2num(intensite{:}))); |
---|
3705 | % end |
---|
3706 | % |
---|
3707 | % % --- Executes on button press in iris_pushbutton25. |
---|
3708 | % function iris_pushbutton25_Callback(hObject, eventdata, handles) |
---|
3709 | % % hObject handle to iris_pushbutton25 (see GCBO) |
---|
3710 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
3711 | % % handles structure with handles and user data (see GUIDATA) |
---|
3712 | % |
---|
3713 | % % %entrer les deux variables vitesse et intensite pour l'iris |
---|
3714 | % % prompt={'entrer la vitesse - valeur entre 1 et 3','entrer l''intensite - valeur entre 1 et 10'}; |
---|
3715 | % % name='IRIS'; |
---|
3716 | % % numlines=1; |
---|
3717 | % % defaultanswer={'3','10'}; |
---|
3718 | % % options.Resize='on'; |
---|
3719 | % % options.WindowStyle='normal'; |
---|
3720 | % % options.Interpreter='tex'; |
---|
3721 | % % val=0; |
---|
3722 | % % % while isequal(val,0) |
---|
3723 | % % choix=inputdlg(prompt,name,numlines,defaultanswer,options); |
---|
3724 | % % % if ~isequal(directory,{}) |
---|
3725 | % % % if ~isdir(strcat('/home/PM/tordeux/matlab_test/',directory{:})) |
---|
3726 | % % % mkdir /home/PM/tordeux/matlab_test/directory; |
---|
3727 | % % % val=1; |
---|
3728 | % % % else |
---|
3729 | % % % button = questdlg('ce dossier existe ! voulez-vous continuer?','ATTENTION','oui','non','non') |
---|
3730 | % % % if isequal(button,'oui') |
---|
3731 | % % % val=1; |
---|
3732 | % % % end |
---|
3733 | % % % end |
---|
3734 | % % % else |
---|
3735 | % % % %avoir deja creᅵ une directory de secours pour si on a fait "cancel".. |
---|
3736 | % % % directory={'secours'}; |
---|
3737 | % % % val=1; |
---|
3738 | % % % end |
---|
3739 | % % % end |
---|
3740 | % |
---|
3741 | % IRIS(handles); |
---|
3742 | % |
---|
3743 | |
---|
3744 | |
---|
3745 | function qualite_edit23_Callback(hObject, eventdata, handles) |
---|
3746 | % hObject handle to qualite_edit23 (see GCBO) |
---|
3747 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3748 | % handles structure with handles and user data (see GUIDATA) |
---|
3749 | |
---|
3750 | % Hints: get(hObject,'String') returns contents of qualite_edit23 as text |
---|
3751 | % str2double(get(hObject,'String')) returns contents of qualite_edit23 as a double |
---|
3752 | |
---|
3753 | |
---|
3754 | % --- Executes during object creation, after setting all properties. |
---|
3755 | function qualite_edit23_CreateFcn(hObject, eventdata, handles) |
---|
3756 | % hObject handle to qualite_edit23 (see GCBO) |
---|
3757 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3758 | % handles empty - handles not created until after all CreateFcns called |
---|
3759 | |
---|
3760 | % Hint: edit controls usually have a white background on Windows. |
---|
3761 | % See ISPC and COMPUTER. |
---|
3762 | if ispc |
---|
3763 | set(hObject,'BackgroundColor','white'); |
---|
3764 | else |
---|
3765 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
3766 | end |
---|
3767 | |
---|
3768 | |
---|
3769 | |
---|
3770 | function LHBB_edit24_Callback(hObject, eventdata, handles) |
---|
3771 | % hObject handle to LHBB_edit24 (see GCBO) |
---|
3772 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3773 | % handles structure with handles and user data (see GUIDATA) |
---|
3774 | |
---|
3775 | % Hints: get(hObject,'String') returns contents of LHBB_edit24 as text |
---|
3776 | % str2double(get(hObject,'String')) returns contents of LHBB_edit24 as a double |
---|
3777 | |
---|
3778 | |
---|
3779 | % --- Executes during object creation, after setting all properties. |
---|
3780 | function LHBB_edit24_CreateFcn(hObject, eventdata, handles) |
---|
3781 | % hObject handle to LHBB_edit24 (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 |
---|
3788 | set(hObject,'BackgroundColor','white'); |
---|
3789 | else |
---|
3790 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
3791 | end |
---|
3792 | |
---|
3793 | |
---|
3794 | |
---|
3795 | function LHBH_edit25_Callback(hObject, eventdata, handles) |
---|
3796 | % hObject handle to LHBH_edit25 (see GCBO) |
---|
3797 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3798 | % handles structure with handles and user data (see GUIDATA) |
---|
3799 | |
---|
3800 | % Hints: get(hObject,'String') returns contents of LHBH_edit25 as text |
---|
3801 | % str2double(get(hObject,'String')) returns contents of LHBH_edit25 as a double |
---|
3802 | |
---|
3803 | |
---|
3804 | % --- Executes during object creation, after setting all properties. |
---|
3805 | function LHBH_edit25_CreateFcn(hObject, eventdata, handles) |
---|
3806 | % hObject handle to LHBH_edit25 (see GCBO) |
---|
3807 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3808 | % handles empty - handles not created until after all CreateFcns called |
---|
3809 | |
---|
3810 | % Hint: edit controls usually have a white background on Windows. |
---|
3811 | % See ISPC and COMPUTER. |
---|
3812 | if ispc |
---|
3813 | set(hObject,'BackgroundColor','white'); |
---|
3814 | else |
---|
3815 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
3816 | end |
---|
3817 | |
---|
3818 | |
---|
3819 | |
---|
3820 | function LBBH_edit26_Callback(hObject, eventdata, handles) |
---|
3821 | % hObject handle to LBBH_edit26 (see GCBO) |
---|
3822 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3823 | % handles structure with handles and user data (see GUIDATA) |
---|
3824 | |
---|
3825 | % Hints: get(hObject,'String') returns contents of LBBH_edit26 as text |
---|
3826 | % str2double(get(hObject,'String')) returns contents of LBBH_edit26 as a double |
---|
3827 | |
---|
3828 | |
---|
3829 | % --- Executes during object creation, after setting all properties. |
---|
3830 | function LBBH_edit26_CreateFcn(hObject, eventdata, handles) |
---|
3831 | % hObject handle to LBBH_edit26 (see GCBO) |
---|
3832 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3833 | % handles empty - handles not created until after all CreateFcns called |
---|
3834 | |
---|
3835 | % Hint: edit controls usually have a white background on Windows. |
---|
3836 | % See ISPC and COMPUTER. |
---|
3837 | if ispc |
---|
3838 | set(hObject,'BackgroundColor','white'); |
---|
3839 | else |
---|
3840 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
3841 | end |
---|
3842 | |
---|
3843 | |
---|
3844 | |
---|
3845 | function LBBB_edit27_Callback(hObject, eventdata, handles) |
---|
3846 | % hObject handle to LBBB_edit27 (see GCBO) |
---|
3847 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3848 | % handles structure with handles and user data (see GUIDATA) |
---|
3849 | |
---|
3850 | % Hints: get(hObject,'String') returns contents of LBBB_edit27 as text |
---|
3851 | % str2double(get(hObject,'String')) returns contents of LBBB_edit27 as a double |
---|
3852 | |
---|
3853 | |
---|
3854 | % --- Executes during object creation, after setting all properties. |
---|
3855 | function LBBB_edit27_CreateFcn(hObject, eventdata, handles) |
---|
3856 | % hObject handle to LBBB_edit27 (see GCBO) |
---|
3857 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3858 | % handles empty - handles not created until after all CreateFcns called |
---|
3859 | |
---|
3860 | % Hint: edit controls usually have a white background on Windows. |
---|
3861 | % See ISPC and COMPUTER. |
---|
3862 | if ispc |
---|
3863 | set(hObject,'BackgroundColor','white'); |
---|
3864 | else |
---|
3865 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
3866 | end |
---|
3867 | |
---|
3868 | |
---|
3869 | % --- Executes on button press in fondGmax_pushbutton29. |
---|
3870 | function fondGmax_pushbutton29_Callback(hObject, eventdata, handles) |
---|
3871 | % hObject handle to fondGmax_pushbutton29 (see GCBO) |
---|
3872 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3873 | % handles structure with handles and user data (see GUIDATA) |
---|
3874 | |
---|
3875 | |
---|
3876 | % --- Executes on button press in fondGmoy_pushbutton30. |
---|
3877 | function fondGmoy_pushbutton30_Callback(hObject, eventdata, handles) |
---|
3878 | % hObject handle to fondGmoy_pushbutton30 (see GCBO) |
---|
3879 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3880 | % handles structure with handles and user data (see GUIDATA) |
---|
3881 | |
---|
3882 | |
---|
3883 | % --- Executes on button press in fondGmin_pushbutton31. |
---|
3884 | function fondGmin_pushbutton31_Callback(hObject, eventdata, handles) |
---|
3885 | % hObject handle to fondGmin_pushbutton31 (see GCBO) |
---|
3886 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3887 | % handles structure with handles and user data (see GUIDATA) |
---|
3888 | |
---|
3889 | |
---|
3890 | |
---|
3891 | function directory_sauvegarde_edit28_Callback(hObject, eventdata, handles) |
---|
3892 | % hObject handle to directory_sauvegarde_edit28 (see GCBO) |
---|
3893 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3894 | % handles structure with handles and user data (see GUIDATA) |
---|
3895 | |
---|
3896 | % Hints: get(hObject,'String') returns contents of directory_sauvegarde_edit28 as text |
---|
3897 | % str2double(get(hObject,'String')) returns contents of directory_sauvegarde_edit28 as a double |
---|
3898 | |
---|
3899 | |
---|
3900 | % % directory principale (dï¿œpend de l'utilisateur !!!) |
---|
3901 | % setappdata(handles.figure1,'directory_principale',directory_principale); |
---|
3902 | % |
---|
3903 | % % directory de sauvegarde en attente |
---|
3904 | % setappdata(handles.figure1,'directory_principale','/home/PM/tordeux/matlab_test/'); |
---|
3905 | % directory_principale=getappdata(handles.figure1,'directory_principale'); |
---|
3906 | % phrase=strcat(directory_principale,'?'); |
---|
3907 | |
---|
3908 | directory_sauvegarde=get(handles.directory_sauvegarde_edit28,'String'); |
---|
3909 | setappdata(handles.figure1,'directory_sauvegarde',directory_sauvegarde); |
---|
3910 | |
---|
3911 | % cas ou la directory n'existe pas |
---|
3912 | %if ~isdir(strcat('/home/PM/tordeux/matlab_test/',directory{:})) |
---|
3913 | if ~isdir( directory_sauvegarde) |
---|
3914 | % mkdir(chemin) |
---|
3915 | % cd(chemin); |
---|
3916 | mkdir(directory_sauvegarde) |
---|
3917 | cd(directory_sauvegarde); |
---|
3918 | |
---|
3919 | %setappdata(handles.figure1,'init_sauvegarde',1); |
---|
3920 | %val=getappdata(handles.figure1,'init_sauvegarde'); |
---|
3921 | %set(handles.directory_sauvegarde_edit28,'String',directory_sauvegarde); |
---|
3922 | setappdata(handles.figure1,'directory_sauvegarde',directory_sauvegarde); |
---|
3923 | |
---|
3924 | % cas ou la directory existe deja |
---|
3925 | else |
---|
3926 | button = questdlg('ce dossier existe ! voulez-vous continuer?','ATTENTION','oui','non','non') ; |
---|
3927 | if isequal(button,'oui') |
---|
3928 | |
---|
3929 | % cd(chemin); |
---|
3930 | cd(directory_sauvegarde); |
---|
3931 | |
---|
3932 | %setappdata(handles.figure1,'init_sauvegarde',1); |
---|
3933 | %val=getappdata(handles.figure1,'init_sauvegarde'); |
---|
3934 | %set(handles.directory_sauvegarde_edit28,'String',directory_sauvegarde); |
---|
3935 | setappdata(handles.figure1,'directory_sauvegarde',directory_sauvegarde); |
---|
3936 | |
---|
3937 | else |
---|
3938 | % retour ᅵ la case dᅵpart |
---|
3939 | |
---|
3940 | end |
---|
3941 | end |
---|
3942 | |
---|
3943 | |
---|
3944 | |
---|
3945 | % --- Executes during object creation, after setting all properties. |
---|
3946 | function directory_sauvegarde_edit28_CreateFcn(hObject, eventdata, handles) |
---|
3947 | % hObject handle to directory_sauvegarde_edit28 (see GCBO) |
---|
3948 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3949 | % handles empty - handles not created until after all CreateFcns called |
---|
3950 | |
---|
3951 | % Hint: edit controls usually have a white background on Windows. |
---|
3952 | % See ISPC and COMPUTER. |
---|
3953 | if ispc |
---|
3954 | set(hObject,'BackgroundColor','white'); |
---|
3955 | else |
---|
3956 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
3957 | end |
---|
3958 | |
---|
3959 | |
---|
3960 | % --- Executes on selection change in backlight_popupmenu3. |
---|
3961 | function backlight_popupmenu3_Callback(hObject, eventdata, handles) |
---|
3962 | % hObject handle to backlight_popupmenu3 (see GCBO) |
---|
3963 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3964 | % handles structure with handles and user data (see GUIDATA) |
---|
3965 | |
---|
3966 | % Hints: contents = get(hObject,'String') returns backlight_popupmenu3 contents as cell array |
---|
3967 | % contents{get(hObject,'Value')} returns selected item from backlight_popupmenu3 |
---|
3968 | |
---|
3969 | %alias |
---|
3970 | device_name = getappdata(handles.figure1,'device_name'); |
---|
3971 | dev = device_name.backlight; |
---|
3972 | |
---|
3973 | val = get(hObject,'Value'); |
---|
3974 | switch val |
---|
3975 | case 1 |
---|
3976 | tango_command_inout(dev,'SetBrightness',uint16(0)); |
---|
3977 | case 2 |
---|
3978 | tango_command_inout(dev,'SetBrightness',uint16(1)); |
---|
3979 | case 3 |
---|
3980 | tango_command_inout(dev,'SetBrightness',uint16(2)); |
---|
3981 | case 4 |
---|
3982 | tango_command_inout(dev,'SetBrightness',uint16(3)); |
---|
3983 | case 5 |
---|
3984 | tango_command_inout(dev,'SetBrightness',uint16(4)); |
---|
3985 | case 6 |
---|
3986 | tango_command_inout(dev,'SetBrightness',uint16(5)); |
---|
3987 | case 7 |
---|
3988 | tango_command_inout(dev,'SetBrightness',uint16(6)); |
---|
3989 | case 8 |
---|
3990 | tango_command_inout(dev,'SetBrightness',uint16(7)); |
---|
3991 | case 9 |
---|
3992 | tango_command_inout(dev,'SetBrightness',uint16(8)); |
---|
3993 | case 10 |
---|
3994 | tango_command_inout(dev,'SetBrightness',uint16(9)); |
---|
3995 | case 11 |
---|
3996 | tango_command_inout(dev,'SetBrightness',uint16(10)); |
---|
3997 | |
---|
3998 | end |
---|
3999 | |
---|
4000 | % --- Executes during object creation, after setting all properties. |
---|
4001 | function backlight_popupmenu3_CreateFcn(hObject, eventdata, handles) |
---|
4002 | % hObject handle to backlight_popupmenu3 (see GCBO) |
---|
4003 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4004 | % handles empty - handles not created until after all CreateFcns called |
---|
4005 | |
---|
4006 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
4007 | % See ISPC and COMPUTER. |
---|
4008 | if ispc |
---|
4009 | set(hObject,'BackgroundColor','white'); |
---|
4010 | else |
---|
4011 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
4012 | end |
---|
4013 | |
---|
4014 | set(hObject, 'String', {'0','1','2','3','4','5','6',... |
---|
4015 | '7','8','9','10',... |
---|
4016 | }); |
---|
4017 | |
---|
4018 | |
---|
4019 | function pos1_edit29_Callback(hObject, eventdata, handles) |
---|
4020 | % hObject handle to pos1_edit29 (see GCBO) |
---|
4021 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4022 | % handles structure with handles and user data (see GUIDATA) |
---|
4023 | |
---|
4024 | % Hints: get(hObject,'String') returns contents of pos1_edit29 as text |
---|
4025 | % str2double(get(hObject,'String')) returns contents of pos1_edit29 as a double |
---|
4026 | |
---|
4027 | % encore ᅵ faire !! |
---|
4028 | |
---|
4029 | |
---|
4030 | % posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
4031 | % posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
4032 | % posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
4033 | % posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
4034 | % posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
4035 | % posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
4036 | % device_name = getappdata(handles.figure1,'device_name'); |
---|
4037 | % |
---|
4038 | % numeropas = get(handles.pos1_edit29,'String'); |
---|
4039 | % errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
4040 | % |
---|
4041 | % if (tango_error == -1) |
---|
4042 | % %- handle error |
---|
4043 | % tango_print_error_stack; |
---|
4044 | % return; |
---|
4045 | % errordlg('erreur tango !','Erreur'); |
---|
4046 | % |
---|
4047 | % else |
---|
4048 | % % cas ou l'axe n'est pas en butee forward (en bas) |
---|
4049 | % % errorstatus=21 dᅵcᅵlᅵration ou arrᅵt dᅵ ᅵ un limit switch sens + |
---|
4050 | % % errorstatus=3 limitswitch forward |
---|
4051 | % |
---|
4052 | % if ~isequal(errorstatus,21)&~isequal(errorstatus,3) |
---|
4053 | % |
---|
4054 | % % si on ï¿œtait en butï¿œe backward, on ï¿œteind le voyant |
---|
4055 | % if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
4056 | % if isequal(logdev1,1) |
---|
4057 | % set(handles.LHBH_edit25,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4058 | % else |
---|
4059 | % set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4060 | % end |
---|
4061 | % end |
---|
4062 | % |
---|
4063 | % % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
4064 | % set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4065 | % set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4066 | % set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4067 | % |
---|
4068 | % |
---|
4069 | % % on bouge |
---|
4070 | % tango_command_inout(dev,'AxisGoToPosition',numeropas); |
---|
4071 | % |
---|
4072 | % % temporisation : |
---|
4073 | % temporisation_mvt_axis(dev); |
---|
4074 | % |
---|
4075 | % while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
4076 | % |
---|
4077 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
4078 | % % on affiche la position de la lentille |
---|
4079 | % pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
4080 | % set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
4081 | % |
---|
4082 | % end |
---|
4083 | % |
---|
4084 | % pause(0.5); |
---|
4085 | % % on ᅵteind le vert ᅵ la fin du mouvement |
---|
4086 | % % on ï¿œcrit une derniï¿œre fois la position de la lentille |
---|
4087 | % |
---|
4088 | % set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4089 | % % on affiche la position de la lentille |
---|
4090 | % pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
4091 | % set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
4092 | % |
---|
4093 | % % si on est arrivᅵ en butᅵe forward on allume le voyant |
---|
4094 | % |
---|
4095 | % errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
4096 | % if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
4097 | % if isequal(logdev1,1) |
---|
4098 | % set(handles.LHBB_edit24,'BackgroundColor','red'); |
---|
4099 | % |
---|
4100 | % else |
---|
4101 | % set(handles.LBBB_edit27,'BackgroundColor','red'); |
---|
4102 | % |
---|
4103 | % end |
---|
4104 | % end |
---|
4105 | % |
---|
4106 | % % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
4107 | % |
---|
4108 | % pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
4109 | % pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
4110 | % if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
4111 | % set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
4112 | % elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
4113 | % set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
4114 | % elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
4115 | % set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
4116 | % end |
---|
4117 | % |
---|
4118 | % else |
---|
4119 | % errordlg('dᅵjᅵ en butee ou erreur','ATTENTION'); |
---|
4120 | % end |
---|
4121 | % end |
---|
4122 | % end |
---|
4123 | % |
---|
4124 | |
---|
4125 | % --- Executes during object creation, after setting all properties. |
---|
4126 | function pos1_edit29_CreateFcn(hObject, eventdata, handles) |
---|
4127 | % hObject handle to pos1_edit29 (see GCBO) |
---|
4128 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4129 | % handles empty - handles not created until after all CreateFcns called |
---|
4130 | |
---|
4131 | % Hint: edit controls usually have a white background on Windows. |
---|
4132 | % See ISPC and COMPUTER. |
---|
4133 | if ispc |
---|
4134 | set(hObject,'BackgroundColor','white'); |
---|
4135 | else |
---|
4136 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
4137 | end |
---|
4138 | |
---|
4139 | |
---|
4140 | |
---|
4141 | function pos2_edit30_Callback(hObject, eventdata, handles) |
---|
4142 | % hObject handle to pos2_edit30 (see GCBO) |
---|
4143 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4144 | % handles structure with handles and user data (see GUIDATA) |
---|
4145 | |
---|
4146 | % Hints: get(hObject,'String') returns contents of pos2_edit30 as text |
---|
4147 | % str2double(get(hObject,'String')) returns contents of pos2_edit30 as a double |
---|
4148 | |
---|
4149 | |
---|
4150 | % --- Executes during object creation, after setting all properties. |
---|
4151 | function pos2_edit30_CreateFcn(hObject, eventdata, handles) |
---|
4152 | % hObject handle to pos2_edit30 (see GCBO) |
---|
4153 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4154 | % handles empty - handles not created until after all CreateFcns called |
---|
4155 | |
---|
4156 | % Hint: edit controls usually have a white background on Windows. |
---|
4157 | % See ISPC and COMPUTER. |
---|
4158 | if ispc |
---|
4159 | set(hObject,'BackgroundColor','white'); |
---|
4160 | else |
---|
4161 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
4162 | end |
---|
4163 | |
---|
4164 | |
---|
4165 | % --- Executes on button press in F_iris_pushbutton32. |
---|
4166 | function F_iris_pushbutton32_Callback(hObject, eventdata, handles) |
---|
4167 | % hObject handle to F_iris_pushbutton32 (see GCBO) |
---|
4168 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4169 | % handles structure with handles and user data (see GUIDATA) |
---|
4170 | |
---|
4171 | device_name = getappdata(handles.figure1,'device_name'); |
---|
4172 | dev = device_name.iris |
---|
4173 | type = 'CloseX'; |
---|
4174 | vitesse = '1'; |
---|
4175 | click = '5'; |
---|
4176 | commandename=strcat(type,vitesse); |
---|
4177 | tango_command_inout(dev,commandename,int32(str2num(click))); |
---|
4178 | |
---|
4179 | |
---|
4180 | % --- Executes on button press in FF_iris_pushbutton33. |
---|
4181 | function FF_iris_pushbutton33_Callback(hObject, eventdata, handles) |
---|
4182 | % hObject handle to FF_iris_pushbutton33 (see GCBO) |
---|
4183 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4184 | % handles structure with handles and user data (see GUIDATA) |
---|
4185 | |
---|
4186 | device_name = getappdata(handles.figure1,'device_name'); |
---|
4187 | dev = device_name.iris |
---|
4188 | type = 'CloseX'; |
---|
4189 | vitesse = '2'; |
---|
4190 | click = '5'; |
---|
4191 | commandename=strcat(type,vitesse); |
---|
4192 | tango_command_inout(dev,commandename,int32(str2num(click))); |
---|
4193 | |
---|
4194 | |
---|
4195 | % --- Executes on button press in FFF_iris_pushbutton34. |
---|
4196 | function FFF_iris_pushbutton34_Callback(hObject, eventdata, handles) |
---|
4197 | % hObject handle to FFF_iris_pushbutton34 (see GCBO) |
---|
4198 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4199 | % handles structure with handles and user data (see GUIDATA) |
---|
4200 | |
---|
4201 | device_name = getappdata(handles.figure1,'device_name'); |
---|
4202 | dev = device_name.iris |
---|
4203 | type = 'CloseX'; |
---|
4204 | vitesse = '3'; |
---|
4205 | click = '5'; |
---|
4206 | commandename=strcat(type,vitesse); |
---|
4207 | tango_command_inout(dev,commandename,int32(str2num(click))); |
---|
4208 | |
---|
4209 | |
---|
4210 | % --- Executes on button press in O_iris_pushbutton35. |
---|
4211 | function O_iris_pushbutton35_Callback(hObject, eventdata, handles) |
---|
4212 | % hObject handle to O_iris_pushbutton35 (see GCBO) |
---|
4213 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4214 | % handles structure with handles and user data (see GUIDATA) |
---|
4215 | |
---|
4216 | device_name = getappdata(handles.figure1,'device_name'); |
---|
4217 | dev = device_name.iris |
---|
4218 | type = 'OpenX'; |
---|
4219 | vitesse = '1'; |
---|
4220 | click = '5'; |
---|
4221 | commandename=strcat(type,vitesse); |
---|
4222 | tango_command_inout(dev,commandename,int32(str2num(click))); |
---|
4223 | |
---|
4224 | |
---|
4225 | % --- Executes on button press in OO_iris_pushbutton36. |
---|
4226 | function OO_iris_pushbutton36_Callback(hObject, eventdata, handles) |
---|
4227 | % hObject handle to OO_iris_pushbutton36 (see GCBO) |
---|
4228 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4229 | % handles structure with handles and user data (see GUIDATA) |
---|
4230 | |
---|
4231 | device_name = getappdata(handles.figure1,'device_name'); |
---|
4232 | dev = device_name.iris |
---|
4233 | type = 'OpenX'; |
---|
4234 | vitesse = '2'; |
---|
4235 | click = '5'; |
---|
4236 | commandename=strcat(type,vitesse); |
---|
4237 | tango_command_inout(dev,commandename,int32(str2num(click))); |
---|
4238 | |
---|
4239 | |
---|
4240 | % --- Executes on button press in OOO_iris_pushbutton38. |
---|
4241 | function OOO_iris_pushbutton38_Callback(hObject, eventdata, handles) |
---|
4242 | % hObject handle to OOO_iris_pushbutton38 (see GCBO) |
---|
4243 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4244 | % handles structure with handles and user data (see GUIDATA) |
---|
4245 | |
---|
4246 | device_name = getappdata(handles.figure1,'device_name'); |
---|
4247 | dev = device_name.iris |
---|
4248 | type = 'OpenX'; |
---|
4249 | vitesse = '3'; |
---|
4250 | click = '5'; |
---|
4251 | commandename=strcat(type,vitesse); |
---|
4252 | tango_command_inout(dev,commandename,int32(str2num(click))); |
---|
4253 | |
---|
4254 | |
---|
4255 | %% What to do before closing the application |
---|
4256 | function Closinggui(obj, event, handles, figure1) |
---|
4257 | |
---|
4258 | %device_name = getappdata(handles.figure1,'device_name'); |
---|
4259 | |
---|
4260 | % Get default command line output from handles structure |
---|
4261 | answer = questdlg('Fermer Emittance ?',... |
---|
4262 | 'Exit Programme Emittance',... |
---|
4263 | 'Yes','No','Yes'); |
---|
4264 | |
---|
4265 | switch answer |
---|
4266 | case 'Yes' |
---|
4267 | delete(handles); %Delete Timer |
---|
4268 | delete(figure1); %Close gui |
---|
4269 | %% extraire l'écran YAG |
---|
4270 | %tango_command_inout(device_name.ecran,'Extract'); |
---|
4271 | %fonction_error; |
---|
4272 | otherwise |
---|
4273 | disp('Closing aborted') |
---|
4274 | end |
---|
4275 | |
---|
4276 | |
---|
4277 | |
---|
4278 | function Q2courant_edit_Callback(hObject, eventdata, handles) |
---|
4279 | % hObject handle to Q2courant_edit (see GCBO) |
---|
4280 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4281 | % handles structure with handles and user data (see GUIDATA) |
---|
4282 | |
---|
4283 | % Hints: get(hObject,'String') returns contents of Q2courant_edit as text |
---|
4284 | % str2double(get(hObject,'String')) returns contents of Q2courant_edit as a double |
---|
4285 | |
---|
4286 | |
---|
4287 | ecriture('Q2',handles) |
---|
4288 | |
---|
4289 | |
---|
4290 | % --- Executes during object creation, after setting all properties. |
---|
4291 | function Q2courant_edit_CreateFcn(hObject, eventdata, handles) |
---|
4292 | % hObject handle to Q2courant_edit (see GCBO) |
---|
4293 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4294 | % handles empty - handles not created until after all CreateFcns called |
---|
4295 | |
---|
4296 | % Hint: edit controls usually have a white background on Windows. |
---|
4297 | % See ISPC and COMPUTER. |
---|
4298 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
4299 | set(hObject,'BackgroundColor','white'); |
---|
4300 | end |
---|
4301 | |
---|
4302 | |
---|
4303 | |
---|
4304 | function H2courant_edit_Callback(hObject, eventdata, handles) |
---|
4305 | % hObject handle to H2courant_edit (see GCBO) |
---|
4306 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4307 | % handles structure with handles and user data (see GUIDATA) |
---|
4308 | |
---|
4309 | % Hints: get(hObject,'String') returns contents of H2courant_edit as text |
---|
4310 | % str2double(get(hObject,'String')) returns contents of H2courant_edit as a double |
---|
4311 | |
---|
4312 | ecriture('H2',handles) |
---|
4313 | |
---|
4314 | |
---|
4315 | % --- Executes during object creation, after setting all properties. |
---|
4316 | function H2courant_edit_CreateFcn(hObject, eventdata, handles) |
---|
4317 | % hObject handle to H2courant_edit (see GCBO) |
---|
4318 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4319 | % handles empty - handles not created until after all CreateFcns called |
---|
4320 | |
---|
4321 | % Hint: edit controls usually have a white background on Windows. |
---|
4322 | % See ISPC and COMPUTER. |
---|
4323 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
4324 | set(hObject,'BackgroundColor','white'); |
---|
4325 | end |
---|
4326 | |
---|
4327 | |
---|
4328 | |
---|
4329 | function edit33_Callback(hObject, eventdata, handles) |
---|
4330 | % hObject handle to edit33 (see GCBO) |
---|
4331 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4332 | % handles structure with handles and user data (see GUIDATA) |
---|
4333 | |
---|
4334 | % Hints: get(hObject,'String') returns contents of edit33 as text |
---|
4335 | % str2double(get(hObject,'String')) returns contents of edit33 as a double |
---|
4336 | |
---|
4337 | |
---|
4338 | % --- Executes during object creation, after setting all properties. |
---|
4339 | function edit33_CreateFcn(hObject, eventdata, handles) |
---|
4340 | % hObject handle to edit33 (see GCBO) |
---|
4341 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4342 | % handles empty - handles not created until after all CreateFcns called |
---|
4343 | |
---|
4344 | % Hint: edit controls usually have a white background on Windows. |
---|
4345 | % See ISPC and COMPUTER. |
---|
4346 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
4347 | set(hObject,'BackgroundColor','white'); |
---|
4348 | end |
---|
4349 | |
---|
4350 | |
---|
4351 | |
---|
4352 | function Q3courant_edit_Callback(hObject, eventdata, handles) |
---|
4353 | % hObject handle to Q3courant_edit (see GCBO) |
---|
4354 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4355 | % handles structure with handles and user data (see GUIDATA) |
---|
4356 | |
---|
4357 | % Hints: get(hObject,'String') returns contents of Q3courant_edit as text |
---|
4358 | % str2double(get(hObject,'String')) returns contents of Q3courant_edit as a double |
---|
4359 | |
---|
4360 | ecriture('Q3',handles) |
---|
4361 | |
---|
4362 | |
---|
4363 | |
---|
4364 | % --- Executes during object creation, after setting all properties. |
---|
4365 | function Q3courant_edit_CreateFcn(hObject, eventdata, handles) |
---|
4366 | % hObject handle to Q3courant_edit (see GCBO) |
---|
4367 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4368 | % handles empty - handles not created until after all CreateFcns called |
---|
4369 | |
---|
4370 | % Hint: edit controls usually have a white background on Windows. |
---|
4371 | % See ISPC and COMPUTER. |
---|
4372 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
4373 | set(hObject,'BackgroundColor','white'); |
---|
4374 | end |
---|
4375 | |
---|
4376 | |
---|
4377 | |
---|
4378 | function Q4courant_edit_Callback(hObject, eventdata, handles) |
---|
4379 | % hObject handle to Q4courant_edit (see GCBO) |
---|
4380 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4381 | % handles structure with handles and user data (see GUIDATA) |
---|
4382 | |
---|
4383 | % Hints: get(hObject,'String') returns contents of Q4courant_edit as text |
---|
4384 | % str2double(get(hObject,'String')) returns contents of Q4courant_edit as a double |
---|
4385 | |
---|
4386 | ecriture('Q4',handles) |
---|
4387 | |
---|
4388 | |
---|
4389 | |
---|
4390 | % --- Executes during object creation, after setting all properties. |
---|
4391 | function Q4courant_edit_CreateFcn(hObject, eventdata, handles) |
---|
4392 | % hObject handle to Q4courant_edit (see GCBO) |
---|
4393 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4394 | % handles empty - handles not created until after all CreateFcns called |
---|
4395 | |
---|
4396 | % Hint: edit controls usually have a white background on Windows. |
---|
4397 | % See ISPC and COMPUTER. |
---|
4398 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
4399 | set(hObject,'BackgroundColor','white'); |
---|
4400 | end |
---|
4401 | |
---|
4402 | |
---|
4403 | |
---|
4404 | function type_edit36_Callback(hObject, eventdata, handles) |
---|
4405 | % hObject handle to type_edit36 (see GCBO) |
---|
4406 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4407 | % handles structure with handles and user data (see GUIDATA) |
---|
4408 | |
---|
4409 | % Hints: get(hObject,'String') returns contents of type_edit36 as text |
---|
4410 | % str2double(get(hObject,'String')) returns contents of type_edit36 as a double |
---|
4411 | |
---|
4412 | |
---|
4413 | % --- Executes during object creation, after setting all properties. |
---|
4414 | function type_edit36_CreateFcn(hObject, eventdata, handles) |
---|
4415 | % hObject handle to type_edit36 (see GCBO) |
---|
4416 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4417 | % handles empty - handles not created until after all CreateFcns called |
---|
4418 | |
---|
4419 | % Hint: edit controls usually have a white background on Windows. |
---|
4420 | % See ISPC and COMPUTER. |
---|
4421 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
4422 | set(hObject,'BackgroundColor','white'); |
---|
4423 | end |
---|
4424 | |
---|
4425 | |
---|
4426 | |
---|
4427 | function nbiter_edit37_Callback(hObject, eventdata, handles) |
---|
4428 | % hObject handle to nbiter_edit37 (see GCBO) |
---|
4429 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4430 | % handles structure with handles and user data (see GUIDATA) |
---|
4431 | |
---|
4432 | % Hints: get(hObject,'String') returns contents of nbiter_edit37 as text |
---|
4433 | % str2double(get(hObject,'String')) returns contents of nbiter_edit37 as a double |
---|
4434 | |
---|
4435 | |
---|
4436 | % --- Executes during object creation, after setting all properties. |
---|
4437 | function nbiter_edit37_CreateFcn(hObject, eventdata, handles) |
---|
4438 | % hObject handle to nbiter_edit37 (see GCBO) |
---|
4439 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4440 | % handles empty - handles not created until after all CreateFcns called |
---|
4441 | |
---|
4442 | % Hint: edit controls usually have a white background on Windows. |
---|
4443 | % See ISPC and COMPUTER. |
---|
4444 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
4445 | set(hObject,'BackgroundColor','white'); |
---|
4446 | end |
---|
4447 | |
---|
4448 | |
---|
4449 | |
---|
4450 | function energie_edit38_Callback(hObject, eventdata, handles) |
---|
4451 | % hObject handle to energie_edit38 (see GCBO) |
---|
4452 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4453 | % handles structure with handles and user data (see GUIDATA) |
---|
4454 | |
---|
4455 | % Hints: get(hObject,'String') returns contents of energie_edit38 as text |
---|
4456 | % str2double(get(hObject,'String')) returns contents of energie_edit38 as a double |
---|
4457 | |
---|
4458 | |
---|
4459 | % --- Executes during object creation, after setting all properties. |
---|
4460 | function energie_edit38_CreateFcn(hObject, eventdata, handles) |
---|
4461 | % hObject handle to energie_edit38 (see GCBO) |
---|
4462 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4463 | % handles empty - handles not created until after all CreateFcns called |
---|
4464 | |
---|
4465 | % Hint: edit controls usually have a white background on Windows. |
---|
4466 | % See ISPC and COMPUTER. |
---|
4467 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
4468 | set(hObject,'BackgroundColor','white'); |
---|
4469 | end |
---|
4470 | |
---|
4471 | % --- Executes on button press in imprimer_pushbutton7. |
---|
4472 | function imprimer_pushbutton17_Callback(hObject, eventdata, handles) |
---|
4473 | % hObject handle to imprimer_pushbutton17 (see GCBO) |
---|
4474 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4475 | % handles structure with handles and user data (see GUIDATA) |
---|
4476 | |
---|
4477 | % Determine file and directory name |
---|
4478 | FileName = '1'; |
---|
4479 | |
---|
4480 | DirectoryName = getappdata(handles.figure1,'directory_sauvegarde'); |
---|
4481 | |
---|
4482 | % Append date_Time to FileName |
---|
4483 | %FileName = sprintf('%s_%s', 'tableau', FileName); |
---|
4484 | FileName = sprintf( '%s_%s','tableau', FileName); |
---|
4485 | |
---|
4486 | %FileName = appendtimestamp(FileName, clock); |
---|
4487 | [FileName, DirectoryName] = uiputfile('*','Save Lattice to ...', [DirectoryName FileName]); |
---|
4488 | if FileName == 0 |
---|
4489 | fprintf(' File not saved (getmachineconfig)\n'); |
---|
4490 | return; |
---|
4491 | end |
---|
4492 | |
---|
4493 | % Save all data in structure to file |
---|
4494 | DirStart = pwd; |
---|
4495 | [DirectoryName, DirectoryErrorFlag] = gotodirectory(DirectoryName); |
---|
4496 | |
---|
4497 | ResultsStr = get(handles.listbox1,'String'); |
---|
4498 | |
---|
4499 | try |
---|
4500 | save(FileName,'ResultsStr') |
---|
4501 | %save(FileName,'ResultsStr','-ascii') |
---|
4502 | %save -ascii mydata.dat |
---|
4503 | catch |
---|
4504 | cd(DirStart); |
---|
4505 | return |
---|
4506 | end |
---|
4507 | cd(DirStart); |
---|
4508 | |
---|
4509 | |
---|
4510 | |
---|
4511 | |
---|
4512 | % --- Executes during object creation, after setting all properties. |
---|
4513 | function imprimer_pushbutton17_CreateFcn(hObject, eventdata, handles) |
---|
4514 | % hObject handle to imprimer_pushbutton17 (see GCBO) |
---|
4515 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4516 | % handles empty - handles not created until after all CreateFcns called |
---|
4517 | |
---|
4518 | % Hint: edit controls usually have a white background on Windows. |
---|
4519 | % See ISPC and COMPUTER. |
---|
4520 | |
---|
4521 | |
---|
4522 | % --- Executes on selection change in camera_controle_popupmenu4. |
---|
4523 | function camera_controle_popupmenu4_Callback(hObject, eventdata, handles) |
---|
4524 | % hObject handle to camera_controle_popupmenu4 (see GCBO) |
---|
4525 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4526 | % handles structure with handles and user data (see GUIDATA) |
---|
4527 | |
---|
4528 | % Hints: contents = get(hObject,'String') returns camera_controle_popupmenu4 contents as cell array |
---|
4529 | % contents{get(hObject,'Value')} returns selected item from camera_controle_popupmenu4 |
---|
4530 | |
---|
4531 | device_name = getappdata(handles.figure1,'device_name'); |
---|
4532 | dev = device_name.videograbber; |
---|
4533 | |
---|
4534 | val = get(hObject,'Value'); |
---|
4535 | switch val |
---|
4536 | |
---|
4537 | case 2 |
---|
4538 | tango_command_inout(dev,'AutoAdjustRefLevels'); |
---|
4539 | disp('AutoAdjustRefLevels') |
---|
4540 | case 3 |
---|
4541 | tango_command_inout(dev,'EnableCorrectedImage'); |
---|
4542 | case 4 |
---|
4543 | tango_command_inout(dev,'EnableCorrectedProfiles'); |
---|
4544 | case 5 |
---|
4545 | tango_command_inout(dev,'EnableProfiles'); |
---|
4546 | case 6 |
---|
4547 | tango_command_inout(dev,'DisableCorrectedImage'); |
---|
4548 | case 7 |
---|
4549 | tango_command_inout(dev,'DisableCorrectedProfiles'); |
---|
4550 | case 8 |
---|
4551 | tango_command_inout(dev,'DisableProfiles'); |
---|
4552 | |
---|
4553 | case 9 |
---|
4554 | tango_command_inout(dev,'GetExposureTime'); |
---|
4555 | % on donne la possibilité de modifier le exposuretime |
---|
4556 | res = tango_command_inout(dev,'GetExposureTime'); |
---|
4557 | prompt={'ExposureTime'}; |
---|
4558 | name='GetExposureTime'; |
---|
4559 | numlines=1; |
---|
4560 | defaultanswer={num2str(res)}; |
---|
4561 | options.Resize='on'; |
---|
4562 | options.WindowStyle='normal'; |
---|
4563 | options.Interpreter='tex'; |
---|
4564 | time = inputdlg(prompt,name,numlines,defaultanswer,options); |
---|
4565 | tango_command_inout(dev,'SetExposureTime',str2num(time{:})); |
---|
4566 | |
---|
4567 | case 10 |
---|
4568 | % on donne la possibilité de modifier le shutterdelay |
---|
4569 | res = tango_command_inout(dev,'GetShutterDelay'); |
---|
4570 | prompt={'ShutterDelay'}; |
---|
4571 | name='GetShutterDelay'; |
---|
4572 | numlines=1; |
---|
4573 | defaultanswer={num2str(res)}; |
---|
4574 | options.Resize='on'; |
---|
4575 | options.WindowStyle='normal'; |
---|
4576 | options.Interpreter='tex'; |
---|
4577 | delay = inputdlg(prompt,name,numlines,defaultanswer,options); |
---|
4578 | tango_command_inout(dev,'SetShutterDelay',str2num(delay{:})); |
---|
4579 | |
---|
4580 | case 11 |
---|
4581 | res = tango_command_inout(dev,'State'); |
---|
4582 | errordlg(res,'State'); |
---|
4583 | case 12 |
---|
4584 | res = tango_command_inout(dev,'Status'); |
---|
4585 | errordlg(res,'Status'); |
---|
4586 | end |
---|
4587 | |
---|
4588 | |
---|
4589 | % --- Executes during object creation, after setting all properties. |
---|
4590 | function camera_controle_popupmenu4_CreateFcn(hObject, eventdata, handles) |
---|
4591 | % hObject handle to camera_controle_popupmenu4 (see GCBO) |
---|
4592 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4593 | % handles empty - handles not created until after all CreateFcns called |
---|
4594 | |
---|
4595 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
4596 | % See ISPC and COMPUTER. |
---|
4597 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
4598 | set(hObject,'BackgroundColor','white'); |
---|
4599 | end |
---|
4600 | |
---|
4601 | |
---|
4602 | % --- Executes on selection change in controle_lentilles_popupmenu5. |
---|
4603 | function controle_lentilles_popupmenu5_Callback(hObject, eventdata, handles) |
---|
4604 | % hObject handle to controle_lentilles_popupmenu5 (see GCBO) |
---|
4605 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4606 | % handles structure with handles and user data (see GUIDATA) |
---|
4607 | |
---|
4608 | % Hints: contents = get(hObject,'String') returns controle_lentilles_popupmenu5 contents as cell array |
---|
4609 | % contents{get(hObject,'Value')} returns selected item from controle_lentilles_popupmenu5 |
---|
4610 | |
---|
4611 | |
---|
4612 | device_name = getappdata(handles.figure1,'device_name'); |
---|
4613 | logdev1=get(handles.Lenthaute_radiobutton7,'Value'); |
---|
4614 | logdev2=get(handles.tata_radiobutton10,'Value'); |
---|
4615 | posl1Gmax = getappdata(handles.figure1,'posl1Gmax'); |
---|
4616 | posl2Gmax = getappdata(handles.figure1,'posl2Gmax'); |
---|
4617 | posl1Gmoy = getappdata(handles.figure1,'posl1Gmoy'); |
---|
4618 | posl2Gmoy = getappdata(handles.figure1,'posl2Gmoy'); |
---|
4619 | posl1Gmin = getappdata(handles.figure1,'posl1Gmin'); |
---|
4620 | posl2Gmin = getappdata(handles.figure1,'posl2Gmin'); |
---|
4621 | device_name = getappdata(handles.figure1,'device_name'); |
---|
4622 | |
---|
4623 | if isequal(logdev1,0)&isequal(logdev2,0) |
---|
4624 | errordlg('selectionnez une lentille','ATTENTION'); |
---|
4625 | else |
---|
4626 | if isequal(logdev1,1) |
---|
4627 | dev=device_name.lentille_haute; |
---|
4628 | else |
---|
4629 | dev=device_name.lentille_basse; |
---|
4630 | end |
---|
4631 | |
---|
4632 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
4633 | |
---|
4634 | if (tango_error == -1) |
---|
4635 | %- handle error |
---|
4636 | tango_print_error_stack; |
---|
4637 | return; |
---|
4638 | errordlg('erreur tango !','Erreur'); |
---|
4639 | |
---|
4640 | else |
---|
4641 | |
---|
4642 | val = get(hObject,'Value'); |
---|
4643 | switch val |
---|
4644 | |
---|
4645 | case 2 |
---|
4646 | prompt={'Entrez une position'}; |
---|
4647 | name='AxisDefinePosition'; |
---|
4648 | numlines=1; |
---|
4649 | defaultanswer={ num2str(0) }; |
---|
4650 | options.Resize='on'; |
---|
4651 | options.WindowStyle='normal'; |
---|
4652 | options.Interpreter='tex'; |
---|
4653 | toto = inputdlg(prompt,name,numlines,defaultanswer,options); |
---|
4654 | if ~isequal(toto,{}) |
---|
4655 | tango_command_inout(dev,'AxisDefinePosition',str2num(toto{:})); |
---|
4656 | fonction_error; |
---|
4657 | |
---|
4658 | if isequal(logdev1,1) |
---|
4659 | % on affiche la position de la lentille |
---|
4660 | pos1=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4661 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
4662 | else |
---|
4663 | % on affiche la position de la lentille |
---|
4664 | pos2=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4665 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
4666 | end |
---|
4667 | |
---|
4668 | end |
---|
4669 | |
---|
4670 | case 3 |
---|
4671 | res = tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
4672 | errordlg(num2str(res),'AxisGetErrorStatus'); |
---|
4673 | |
---|
4674 | case 4 |
---|
4675 | res = tango_command_inout(dev,'AxisGetMotionStatus'); |
---|
4676 | errordlg(num2str(res),'AxisGetMotionStatus'); |
---|
4677 | |
---|
4678 | case 5 |
---|
4679 | prompt={'Entrez une position de destination'}; |
---|
4680 | name='AxisGoToPosition'; |
---|
4681 | numlines=1; |
---|
4682 | defaultanswer={ num2str(0) }; |
---|
4683 | options.Resize='on'; |
---|
4684 | options.WindowStyle='normal'; |
---|
4685 | options.Interpreter='tex'; |
---|
4686 | toto = inputdlg(prompt,name,numlines,defaultanswer,options); |
---|
4687 | if ~isequal(toto,{}) |
---|
4688 | |
---|
4689 | posref=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4690 | fonction_error; |
---|
4691 | |
---|
4692 | if str2num(toto{:})>posref.value |
---|
4693 | % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
4694 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4695 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4696 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4697 | |
---|
4698 | % si on ï¿œtait en butï¿œe backward, on ï¿œteind le voyant |
---|
4699 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
4700 | if isequal(logdev1,1) |
---|
4701 | set(handles.LHBH_edit25,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4702 | else |
---|
4703 | set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4704 | end |
---|
4705 | end |
---|
4706 | |
---|
4707 | elseif str2num(toto{:})<posref.value |
---|
4708 | |
---|
4709 | % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
4710 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4711 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4712 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4713 | |
---|
4714 | % si on ï¿œtait en butï¿œe forward, on ï¿œteind le voyant |
---|
4715 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
4716 | if isequal(logdev1,1) |
---|
4717 | set(handles.LHBB_edit24,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4718 | else |
---|
4719 | set(handles.LBBB_edit27,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4720 | end |
---|
4721 | end |
---|
4722 | |
---|
4723 | else |
---|
4724 | return; |
---|
4725 | end |
---|
4726 | |
---|
4727 | % on déplace l'axe jusqu'à la position demandée |
---|
4728 | tango_command_inout(dev,'AxisGoToPosition',str2num(toto{:})); |
---|
4729 | % on attent que l'axe se mette en mouvement |
---|
4730 | if (temporisation_mvt_axis(dev) == -1) |
---|
4731 | % abort |
---|
4732 | end |
---|
4733 | |
---|
4734 | % attendre la fin de la commande en clignotant |
---|
4735 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
4736 | if isequal(logdev1,1) |
---|
4737 | set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
4738 | % on affiche la position de la lentille |
---|
4739 | pos1=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4740 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
4741 | else |
---|
4742 | set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
4743 | % on affiche la position de la lentille |
---|
4744 | pos2=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4745 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
4746 | end |
---|
4747 | end |
---|
4748 | |
---|
4749 | pause(0.5); |
---|
4750 | % on ᅵteind le vert ᅵ la fin du mouvement |
---|
4751 | % on ï¿œcrit une derniï¿œre fois la position de la lentille |
---|
4752 | |
---|
4753 | if isequal(logdev1,1) |
---|
4754 | set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4755 | % on affiche la position de la lentille |
---|
4756 | pos1=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4757 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
4758 | |
---|
4759 | else |
---|
4760 | set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4761 | pos2=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4762 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
4763 | |
---|
4764 | end |
---|
4765 | |
---|
4766 | % si on est arrivᅵ en butᅵe forward on allume le voyant |
---|
4767 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
4768 | fonction_error; |
---|
4769 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
4770 | if isequal(logdev1,1) |
---|
4771 | set(handles.LHBB_edit24,'BackgroundColor','red'); |
---|
4772 | else |
---|
4773 | set(handles.LBBB_edit27,'BackgroundColor','red'); |
---|
4774 | end |
---|
4775 | end |
---|
4776 | |
---|
4777 | % si on est arrivᅵ en butᅵe backward on allume le voyant |
---|
4778 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
4779 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
4780 | if isequal(logdev1,1) |
---|
4781 | set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
4782 | else |
---|
4783 | set(handles.LBBH_edit26,'BackgroundColor','red'); |
---|
4784 | end |
---|
4785 | end |
---|
4786 | |
---|
4787 | % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
4788 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
4789 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
4790 | if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
4791 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
4792 | elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
4793 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
4794 | elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
4795 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
4796 | end |
---|
4797 | end |
---|
4798 | |
---|
4799 | case 6 |
---|
4800 | prompt={'Entrez une position relative de destination'}; |
---|
4801 | name='AxisGoToRelativePosition'; |
---|
4802 | numlines=1; |
---|
4803 | defaultanswer={ num2str(0) }; |
---|
4804 | options.Resize='on'; |
---|
4805 | options.WindowStyle='normal'; |
---|
4806 | options.Interpreter='tex'; |
---|
4807 | toto = inputdlg(prompt,name,numlines,defaultanswer,options); |
---|
4808 | if ~isequal(toto,{}) |
---|
4809 | |
---|
4810 | posref=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4811 | fonction_error; |
---|
4812 | |
---|
4813 | if str2num(toto{:})>0 |
---|
4814 | % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
4815 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4816 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4817 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4818 | |
---|
4819 | % si on ï¿œtait en butï¿œe backward, on ï¿œteind le voyant |
---|
4820 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
4821 | if isequal(logdev1,1) |
---|
4822 | set(handles.LHBH_edit25,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4823 | else |
---|
4824 | set(handles.LBBH_edit26,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4825 | end |
---|
4826 | end |
---|
4827 | |
---|
4828 | elseif str2num(toto{:})<0 |
---|
4829 | |
---|
4830 | % pour le cas oᅵ on ᅵtait dans les conditions d'un grandissement, ᅵteindre tous les voyants rouges grandissements |
---|
4831 | set(handles.fondGmax_pushbutton29,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4832 | set(handles.fondGmoy_pushbutton30,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4833 | set(handles.fondGmin_pushbutton31,'BackgroundColor',[0.979 1.0 0.822]); |
---|
4834 | |
---|
4835 | % si on ï¿œtait en butï¿œe forward, on ï¿œteind le voyant |
---|
4836 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
4837 | if isequal(logdev1,1) |
---|
4838 | set(handles.LHBB_edit24,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4839 | else |
---|
4840 | set(handles.LBBB_edit27,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4841 | end |
---|
4842 | end |
---|
4843 | |
---|
4844 | else |
---|
4845 | return; |
---|
4846 | end |
---|
4847 | |
---|
4848 | % on déplace l'axe jusqu'à la position demandée |
---|
4849 | tango_command_inout(dev,'AxisGoToRelativePosition',str2num(toto{:})); |
---|
4850 | % on attent que l'axe se mette en mouvement |
---|
4851 | if (temporisation_mvt_axis(dev) == -1) |
---|
4852 | % abort |
---|
4853 | end |
---|
4854 | |
---|
4855 | % attendre la fin de la commande en clignotant |
---|
4856 | while isequal(tango_command_inout(dev,'AxisGetMotionStatus'),1) |
---|
4857 | if isequal(logdev1,1) |
---|
4858 | set(handles.Lenthaute_radiobutton7,'BackgroundColor','green'); |
---|
4859 | % on affiche la position de la lentille |
---|
4860 | pos1=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4861 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
4862 | else |
---|
4863 | set(handles.tata_radiobutton10,'BackgroundColor','green'); |
---|
4864 | % on affiche la position de la lentille |
---|
4865 | pos2=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4866 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
4867 | end |
---|
4868 | end |
---|
4869 | |
---|
4870 | pause(0.5); |
---|
4871 | % on ᅵteind le vert ᅵ la fin du mouvement |
---|
4872 | % on ï¿œcrit une derniï¿œre fois la position de la lentille |
---|
4873 | |
---|
4874 | if isequal(logdev1,1) |
---|
4875 | set(handles.Lenthaute_radiobutton7,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4876 | % on affiche la position de la lentille |
---|
4877 | pos1=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4878 | set(handles.pos1_edit29,'String',num2str(pos1.value(1))); |
---|
4879 | |
---|
4880 | else |
---|
4881 | set(handles.tata_radiobutton10,'BackgroundColor',[0.702 0.702 0.702]); |
---|
4882 | pos2=tango_read_attribute(dev,'AxisCurrentMotorPosition'); |
---|
4883 | set(handles.pos2_edit30,'String',num2str(pos2.value(1))); |
---|
4884 | |
---|
4885 | end |
---|
4886 | |
---|
4887 | % si on est arrivᅵ en butᅵe forward on allume le voyant |
---|
4888 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
4889 | fonction_error; |
---|
4890 | if isequal(errorstatus,21)|isequal(errorstatus,3) |
---|
4891 | if isequal(logdev1,1) |
---|
4892 | set(handles.LHBB_edit24,'BackgroundColor','red'); |
---|
4893 | else |
---|
4894 | set(handles.LBBB_edit27,'BackgroundColor','red'); |
---|
4895 | end |
---|
4896 | end |
---|
4897 | |
---|
4898 | % si on est arrivᅵ en butᅵe backward on allume le voyant |
---|
4899 | errorstatus=tango_command_inout(dev,'AxisGetErrorStatus'); |
---|
4900 | if isequal(errorstatus,22)|isequal(errorstatus,4) |
---|
4901 | if isequal(logdev1,1) |
---|
4902 | set(handles.LHBH_edit25,'BackgroundColor','red'); |
---|
4903 | else |
---|
4904 | set(handles.LBBH_edit26,'BackgroundColor','red'); |
---|
4905 | end |
---|
4906 | end |
---|
4907 | |
---|
4908 | % si on est sur une position dï¿œterminï¿œe d'un grandissement, allumer en rouge celui-ci |
---|
4909 | pos1=tango_read_attribute(device_name.lentille_haute,'AxisCurrentMotorPosition'); |
---|
4910 | pos2=tango_read_attribute(device_name.lentille_basse,'AxisCurrentMotorPosition'); |
---|
4911 | if isequal(pos1.value(1),posl1Gmax)&isequal(pos2.value(1),posl2Gmax) |
---|
4912 | set(handles.fondGmax_pushbutton29,'BackgroundColor','red'); |
---|
4913 | elseif isequal(pos1.value(1),posl1Gmoy)&isequal(pos2.value(1),posl2Gmoy) |
---|
4914 | set(handles.fondGmoy_pushbutton30,'BackgroundColor','red'); |
---|
4915 | elseif isequal(pos1.value(1),posl1Gmin)&isequal(pos2.value(1),posl2Gmin) |
---|
4916 | set(handles.fondGmin_pushbutton31,'BackgroundColor','red'); |
---|
4917 | end |
---|
4918 | end |
---|
4919 | |
---|
4920 | |
---|
4921 | case 11 |
---|
4922 | res = tango_command_inout(dev,'State'); |
---|
4923 | errordlg(res,'State'); |
---|
4924 | case 12 |
---|
4925 | res = tango_command_inout(dev,'Status'); |
---|
4926 | errordlg(res,'Status'); |
---|
4927 | |
---|
4928 | end |
---|
4929 | end |
---|
4930 | end |
---|
4931 | |
---|
4932 | |
---|
4933 | |
---|
4934 | |
---|
4935 | |
---|
4936 | % --- Executes during object creation, after setting all properties. |
---|
4937 | function controle_lentilles_popupmenu5_CreateFcn(hObject, eventdata, handles) |
---|
4938 | % hObject handle to controle_lentilles_popupmenu5 (see GCBO) |
---|
4939 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
4940 | % handles empty - handles not created until after all CreateFcns called |
---|
4941 | |
---|
4942 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
4943 | % See ISPC and COMPUTER. |
---|
4944 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
4945 | set(hObject,'BackgroundColor','white'); |
---|
4946 | end |
---|
4947 | |
---|
4948 | |
---|