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