source: MML/trunk/machine/SOLEIL/StorageRing/Ringcycling.m @ 17

Last change on this file since 17 was 17, checked in by zhangj, 10 years ago

To have a stable version on the server.

  • Property svn:executable set to *
File size: 44.4 KB
Line 
1function varargout = Ringcycling(varargin)
2% RINGCYCLING M-file for Ringcycling.fig
3%      RINGCYCLING, by itself, creates a new RINGCYCLING or raises the existing
4%      singleton*.
5%
6%      H = RINGCYCLING returns the handle to a new RINGCYCLING or the handle to
7%      the existing singleton*.
8%
9%      RINGCYCLING('CALLBACK',hObject,eventData,handles,...) calls the local
10%      function named CALLBACK in RINGCYCLING.M with the given input arguments.
11%
12%      RINGCYCLING('Property','Value',...) creates a new RINGCYCLING or raises the
13%      existing singleton*.  Starting from the left, property value pairs are
14%      applied to the GUI before Ringcycling_OpeningFunction gets called.  An
15%      unrecognized property name or invalid value makes property application
16%      stop.  All inputs are passed to Ringcycling_OpeningFcn via varargin.
17%
18%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
19%      instance to run (singleton)".
20%
21% See also: getcyclecurve, magnetcycle, LT1cycling, setcyclecurve, cyclingcommand
22
23% Edit the above text to modify the response to help Ringcycling
24
25% Last Modified by GUIDE v2.5 21-Mar-2011 15:16:03
26
27% Begin initialization code - DO NOT EDIT
28gui_Singleton = 1;
29gui_State = struct('gui_Name',       mfilename, ...
30                   'gui_Singleton',  gui_Singleton, ...
31                   'gui_OpeningFcn', @Ringcycling_OpeningFcn, ...
32                   'gui_OutputFcn',  @Ringcycling_OutputFcn, ...
33                   'gui_LayoutFcn',  [] , ...
34                   'gui_Callback',   []);
35if nargin && ischar(varargin{1})
36    gui_State.gui_Callback = str2func(varargin{1});
37end
38
39if nargout
40    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
41else
42    gui_mainfcn(gui_State, varargin{:});
43end
44% End initialization code - DO NOT EDIT
45
46
47% --- Executes just before Ringcycling is made visible.
48function Ringcycling_OpeningFcn(hObject, eventdata, handles, varargin)
49% This function has no output args, see OutputFcn.
50% hObject    handle to figure
51% eventdata  reserved - to be defined in a future version of MATLAB
52% handles    structure with handles and user data (see GUIDATA)
53% varargin   command line arguments to Ringcycling (see VARARGIN)
54
55% Choose default command line output for Ringcycling
56handles.output = hObject;
57
58% A MODIFIER ULTERIEUREMENT : INACTIVATION DES FONCTIONS
59% CYCLAGE CORRECTEURS / ALL
60set(handles.checkbox_HCOR,'Value',0);
61set(handles.checkbox_VCOR,'Value',0);
62set(handles.checkbox_all,'Value',0);
63set(handles.checkbox_all,'Enable','Off');
64%set([handles.checkbox_all,handles.checkbox_HCOR,handles.checkbox_VCOR],...
65%    'Enable','off');
66
67% par defaut type cyclage sur 'full'
68set(handles.popupmenu_type,'Value',2);
69
70% button group sur switch mode simulation ou online
71h = uibuttongroup('visible','off','Position',[0.56 0.46 .18 .10],...
72    'Title','','TitlePosition','centertop',...
73    'BackgroundColor',[0.696 1.0 0.924]);
74u1 = uicontrol('Style','Radio','String','premier element','Tag','radiobutton1',...
75    'pos',[10 25 120 25],'parent',h,'HandleVisibility','off',...
76    'BackgroundColor',[0.696 1.0 0.924]);
77u2 = uicontrol('Style','Radio','String','toute la famille','Tag','radiobutton2',...
78    'pos',[10 0.95 120 25],'parent',h,'HandleVisibility','off',...
79    'BackgroundColor',[0.696 1.0 0.924]);
80
81set(h,'SelectionChangeFcn',...
82    {@uibuttongroup_SelectionChangeFcn,handles});
83
84set(h,'SelectedObject',u1);  % No selection
85set(h,'Visible','on');
86
87% mode de plot
88handles.mode = '1element';
89handles.configmode = 'confignano';
90
91% Update handles structure
92guidata(hObject, handles);
93
94% UIWAIT makes Ringcycling wait for user response (see UIRESUME)
95% uiwait(handles.figure1);
96list = {'Present', 'Golden', 'UserSelect'};
97set(handles.popupmenu_file,'String',list);
98
99list = {'Simple', 'Full', 'startup'};
100set(handles.popupmenu_type,'String',list);
101
102list = {'Load cycling curve','Start', 'StartOnly', 'Stop', 'Init', 'Pause', 'Resume'};
103set(handles.popupmenu_command,'String',list);
104
105% --- Outputs from this function are returned to the command line.
106function varargout = Ringcycling_OutputFcn(hObject, eventdata, handles)
107% varargout  cell array for returning output args (see VARARGOUT);
108% hObject    handle to figure
109% eventdata  reserved - to be defined in a future version of MATLAB
110% handles    structure with handles and user data (see GUIDATA)
111
112% Get default command line output from handles structure
113varargout{1} = handles.output;
114
115
116% --- Executes on button press in checkbox_none.
117function checkbox_none_Callback(hObject, eventdata, handles)
118% hObject    handle to checkbox_none (see GCBO)
119% eventdata  reserved - to be defined in a future version of MATLAB
120% handles    structure with handles and user data (see GUIDATA)
121
122% Hint: get(hObject,'Value') returns toggle state of checkbox_none
123val = get(hObject,'Value');
124
125if val
126    set(handles.checkbox_BEND,'Value',0);
127    set(handles.checkbox_HCOR,'Value',0);
128    set(handles.checkbox_VCOR,'Value',0);
129    set(handles.checkbox_QT,'Value',0);
130   
131    % Quads   
132    for k =1:length(findmemberof('QUAD')),
133        Name = strcat('Q',num2str(k));
134        set(handles.(['checkbox_',Name]),'Value',0)
135    end
136   
137    % Sextu
138    set(handles.checkbox_S1,'Value',0);
139    set(handles.checkbox_S2,'Value',0);
140    set(handles.checkbox_S3,'Value',0);
141    set(handles.checkbox_S4,'Value',0);
142    set(handles.checkbox_S5,'Value',0);
143    set(handles.checkbox_S6,'Value',0);
144    set(handles.checkbox_S7,'Value',0);
145    set(handles.checkbox_S8,'Value',0);
146    set(handles.checkbox_S9,'Value',0);
147    set(handles.checkbox_S10,'Value',0);
148    set(handles.checkbox_S11,'Value',0);
149    set(handles.checkbox_S12,'Value',0);
150
151    set(handles.checkbox_all,'Value',0);
152    set(handles.checkbox_AllQuad,'Value',0);
153    set(handles.checkbox_AllSextu,'Value',0);
154    set(handles.checkbox_noneQuad,'Value',1);
155    set(handles.checkbox_NoneSextu,'Value',1);
156
157end
158
159% --- Executes on button press in checkbox_all.
160function checkbox_all_Callback(hObject, eventdata, handles)
161% hObject    handle to checkbox_all (see GCBO)
162% eventdata  reserved - to be defined in a future version of MATLAB
163% handles    structure with handles and user data (see GUIDATA)
164
165% Hint: get(hObject,'Value') returns toggle state of checkbox_all
166
167% not used
168disp('checkbox_all_Callback: Not used');
169return;
170val = get(hObject,'Value');
171
172if val
173    set(handles.checkbox_BEND,'Value',1);
174   
175    % Quad
176   
177    for k =1:10, %length(findmemberof('QUAD')), %to avoid nanoscopium
178        Name = strcat('Q',num2str(k));
179        set(handles.(['checkbox_',Name]),'Value',1)
180    end
181   
182    % Sextu       
183    set(handles.checkbox_S1,'Value',1);
184    set(handles.checkbox_S2,'Value',1);
185    set(handles.checkbox_S3,'Value',1);
186    set(handles.checkbox_S4,'Value',1);
187    set(handles.checkbox_S5,'Value',1);
188    set(handles.checkbox_S6,'Value',1);
189    set(handles.checkbox_S7,'Value',1);
190    set(handles.checkbox_S8,'Value',1);
191    set(handles.checkbox_S9,'Value',1);
192    set(handles.checkbox_S10,'Value',1);
193    % Correctors
194    set(handles.checkbox_HCOR,'Value',1);
195    set(handles.checkbox_VCOR,'Value',1);
196    % none
197    set(handles.checkbox_none,'Value',0);
198end
199
200
201% --- Executes on button press in checkbox_BEND.
202function checkbox_BEND_Callback(hObject, eventdata, handles)
203% hObject    handle to checkbox_BEND (see GCBO)
204% eventdata  reserved - to be defined in a future version of MATLAB
205% handles    structure with handles and user data (see GUIDATA)
206
207% Hint: get(hObject,'Value') returns toggle state of checkbox_BEND
208
209set(handles.checkbox_all,'Value',0);
210set(handles.checkbox_none,'Value',0);
211val = get(handles.checkbox_BEND,'Value');
212valQ1 = get(handles.checkbox_Q1,'Value');valQ2 = get(handles.checkbox_Q2,'Value');
213valQ3 = get(handles.checkbox_Q3,'Value');valQ4 = get(handles.checkbox_Q4,'Value');
214valQ5 = get(handles.checkbox_Q5,'Value');valQ6 = get(handles.checkbox_Q6,'Value');
215valQ7 = get(handles.checkbox_Q7,'Value');valQ8 = get(handles.checkbox_Q8,'Value');
216valQ9 = get(handles.checkbox_Q9,'Value');valQ10 = get(handles.checkbox_Q10,'Value');
217valQtous = get(handles.checkbox_AllQuad,'Value');
218valeurs = [valQ1 valQ2 valQ3 valQ4 valQ5 valQ6 valQ7 valQ8 valQ9 valQ10 valQtous];
219test = ones(11,1)'*0;
220
221if val   
222    if ~isequal(valeurs,test)
223        errordlg('conflit entre Quad et Dipole !','Erreur');
224        set(handles.checkbox_BEND,'Value',0);
225        return
226    end
227   
228    % Disable cycling quadrupole and sextupoles
229    for k = 1:length(findmemberof('QUAD')) % to avoid nanoscopium
230        Name = strcat('Q',num2str(k));
231        set(handles.(['checkbox_',Name]),'Enable','off')
232    end
233    set(handles.checkbox_AllQuad,'Enable','off');
234
235    set(handles.checkbox_AllSextu,'Enable','off')
236    for k = 1:length(findmemberof('SEXT'))
237        Name = strcat('S',num2str(k));
238        set(handles.(['checkbox_',Name]),'Enable','off')
239    end   
240
241else
242    val2 = get(handles.checkbox_AllQuad,'Value');
243    if val2==0
244       
245        % Enable cyling of quad and sextu
246        for k = 1:length(findmemberof('QUAD')) % to avoid nanoscopium
247            Name = strcat('Q',num2str(k));
248            set(handles.(['checkbox_',Name]),'Enable','on')
249        end
250        set(handles.checkbox_AllQuad,'Enable','on');
251
252        set(handles.checkbox_AllSextu,'Enable','on')
253        for k = 1:length(findmemberof('SEXT'))
254            Name = strcat('S',num2str(k));
255            set(handles.(['checkbox_',Name]),'Enable','on')
256        end
257
258    end
259end
260
261
262
263% --- Executes on button press in checkbox_Q1.
264function checkbox_Q1_Callback(hObject, eventdata, handles)
265% hObject    handle to checkbox_Q1 (see GCBO)
266% eventdata  reserved - to be defined in a future version of MATLAB
267% handles    structure with handles and user data (see GUIDATA)
268
269% Hint: get(hObject,'Value') returns toggle state of checkbox_Q1
270
271set(handles.checkbox_all,'Value',0);
272set(handles.checkbox_none,'Value',0);
273
274% --- Executes on button press in checkbox_HCOR.
275function checkbox_HCOR_Callback(hObject, eventdata, handles)
276% hObject    handle to checkbox_HCOR (see GCBO)
277% eventdata  reserved - to be defined in a future version of MATLAB
278% handles    structure with handles and user data (see GUIDATA)
279
280% Hint: get(hObject,'Value') returns toggle state of checkbox_HCOR
281
282set(handles.checkbox_all,'Value',0);
283set(handles.checkbox_none,'Value',0);
284
285% --- Executes on button press in checkbox_VCOR.
286function checkbox_VCOR_Callback(hObject, eventdata, handles)
287% hObject    handle to checkbox_VCOR (see GCBO)
288% eventdata  reserved - to be defined in a future version of MATLAB
289% handles    structure with handles and user data (see GUIDATA)
290
291% Hint: get(hObject,'Value') returns toggle state of checkbox_VCOR
292
293set(handles.checkbox_all,'Value',0);
294set(handles.checkbox_none,'Value',0);
295
296% --- Executes on button press in pushbutton_apply.
297function pushbutton_apply_Callback(hObject, eventdata, handles)
298% hObject    handle to pushbutton_apply (see GCBO)
299% eventdata  reserved - to be defined in a future version of MATLAB
300% handles    structure with handles and user data (see GUIDATA)
301
302contents = get(handles.popupmenu_command,'String');
303command = contents{get(handles.popupmenu_command,'Value')};
304
305switch command
306    case {'Load cycling curve','Start', 'StartOnly', 'Stop','Init','Pause','Resume'}
307        cyclemagnet_local(command,handles);
308    otherwise
309        error('Unknown command name: %s ', command);
310end
311
312
313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
315
316 function cyclemagnet_local(command,handles)
317
318%     [CycleIndex, CycleAO] = isfamily(CycleFamily);
319%
320%     rep = tango_group_command_inout2(CycleAO.GroupId,'State',1,0);
321
322Family={'QC13','BEND',...
323        'Q1','Q2','Q3','Q4','Q5',...
324        'Q6','Q7','Q8','Q9','Q10',...
325        'Q11', 'Q12', ...
326        'S1','S2','S3','S4','S5',...
327        'S6','S7','S8','S9','S10',...
328        'S11', 'S12', ...
329        'HCOR','VCOR', 'QT'};   
330   
331Families = {};
332for k =1:length(Family)
333    if get(handles.(['checkbox_',Family{k}]),'Value')
334        Families = {Families{:}, Family{k}};
335    end
336end
337
338% Check if quad ie magnets with offsets used for FFWD on tunes
339quadFlag = 0;
340for k=1:length(Families),
341    if ismemberof(Families{k}, 'QUAD')
342        quadFlag = 1;
343    end
344end
345
346
347if quadFlag
348    % Disable undulator tune FFWD
349    % tango_write_attribute2('ans/ei/nuffwd', 'booleanResult', uint8(0))
350    % Should give back 0
351    % temp = tango_read_attribute2('ans/ei/nuffwd', 'booleanResult')
352    FFWDFlag = readattribute('ans/ei/nuffwd/booleanResult');
353    if FFWDFlag ~=0
354        errordlg(sprintf('Tune FFWD still active\n Cycling aborted'));
355        return;
356    else
357        Answer = questdlg('Forcing Offsets of quadrupoles to zero (no: cancel)', 'Confirmation box','Yes','No','No');
358        if strcmpi(Answer, 'No')
359            %
360        else
361            setquadoffset2zero
362            pause(1);
363        end
364        % Check Offsets before any cycling
365        % Set offsets to zero
366        lineStr = sprintf('Offsets non zero\n\n');
367        NonZeroOffsetFlag =0; Str1={'yes', 'no'};
368        for k=1:length(Families),
369            if ismemberof(Families{k}, 'QUAD')
370                 % Check offset null
371                 lineStr = [lineStr sprintf('Family % 4s  Offset null ? %s \n', Families{k}, ...
372                     Str1{any(getpv(Families{k}, 'SumOffset') ~= 0)})];
373                 NonZeroOffsetFlag =any(getpv(Families{k}, 'SumOffset') ~= 0) | NonZeroOffsetFlag;
374            end
375        end
376       
377        % Popup menu if nonzero offsets
378        if NonZeroOffsetFlag
379            lineStr = [lineStr sprintf('\n\n Continue ?\n');];
380            Answer = questdlg(lineStr, 'Cycling','Yes','No','No');
381            if strcmpi(Answer, 'No')
382                return;
383            end
384        end
385        % ANS-C10/EI/C-U20_OFFF/nuffCorrectionOuputEnabled
386    end
387end
388
389switch command
390    case {'Start'}
391        % get cycling file
392        contents = get(handles.popupmenu_file,'String');
393        file = contents{get(handles.popupmenu_file,'Value')};
394
395        % get cycling type
396        contents = get(handles.popupmenu_type,'String');
397        type = contents{get(handles.popupmenu_type,'Value')};
398
399        % cycle magnets
400        magnetcycle(type,file,Families,'NoDisplay','Config');
401       
402    case {'StartOnly'}
403        % get cycling file
404        contents = get(handles.popupmenu_file,'String');
405        file = contents{get(handles.popupmenu_file,'Value')};
406
407        % get cycling type
408        contents = get(handles.popupmenu_type,'String');
409        type = contents{get(handles.popupmenu_type,'Value')};
410
411        % Cycle magnet
412        magnetcycle(type,file,Families,'NoDisplay','NoConfig');
413
414    case {'Load cycling curve'}
415       
416        contents = get(handles.popupmenu_file,'String');
417        file = contents{get(handles.popupmenu_file,'Value')};
418
419        % get cycling file
420        contents = get(handles.popupmenu_type,'String');
421        type = contents{get(handles.popupmenu_type,'Value')};
422
423        % Config magnet
424        magnetcycle(type,file,Families,'NoDisplay','Config','NoApply');
425       
426       
427    case {'Stop','Init','Pause','Resume'}
428        for k =1:length(Families)
429            CycleFamily = ['Cycle' Families{k}];
430            cyclingcommand(CycleFamily,command);
431        end
432end
433
434% --- Executes on selection change in popupmenu_command.
435function popupmenu_command_Callback(hObject, eventdata, handles)
436% hObject    handle to popupmenu_command (see GCBO)
437% eventdata  reserved - to be defined in a future version of MATLAB
438% handles    structure with handles and user data (see GUIDATA)
439
440% Hints: contents = get(hObject,'String') returns popupmenu_command contents as cell array
441%        contents{get(hObject,'Value')} returns selected item from popupmenu_command
442
443% --- Executes during object creation, after setting all properties.
444function popupmenu_command_CreateFcn(hObject, eventdata, handles)
445% hObject    handle to popupmenu_command (see GCBO)
446% eventdata  reserved - to be defined in a future version of MATLAB
447% handles    empty - handles not created until after all CreateFcns called
448
449% Hint: popupmenu controls usually have a white background on Windows.
450%       See ISPC and COMPUTER.
451if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
452    set(hObject,'BackgroundColor','white');
453end
454
455
456% --- Executes on selection change in popupmenu_type.
457function popupmenu_type_Callback(hObject, eventdata, handles)
458% hObject    handle to popupmenu_type (see GCBO)
459% eventdata  reserved - to be defined in a future version of MATLAB
460% handles    structure with handles and user data (see GUIDATA)
461
462% Hints: contents = get(hObject,'String') returns popupmenu_type contents as cell array
463%        contents{get(hObject,'Value')} returns selected item from popupmenu_type
464
465
466% --- Executes during object creation, after setting all properties.
467function popupmenu_type_CreateFcn(hObject, eventdata, handles)
468% hObject    handle to popupmenu_type (see GCBO)
469% eventdata  reserved - to be defined in a future version of MATLAB
470% handles    empty - handles not created until after all CreateFcns called
471
472% Hint: popupmenu controls usually have a white background on Windows.
473%       See ISPC and COMPUTER.
474if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
475    set(hObject,'BackgroundColor','white');
476end
477
478
479% --- Executes on selection change in popupmenu_file.
480function popupmenu_file_Callback(hObject, eventdata, handles)
481% hObject    handle to popupmenu_file (see GCBO)
482% eventdata  reserved - to be defined in a future version of MATLAB
483% handles    structure with handles and user data (see GUIDATA)
484
485% Hints: contents = get(hObject,'String') returns popupmenu_file contents as cell array
486%        contents{get(hObject,'Value')} returns selected item from popupmenu_file
487
488
489% --- Executes during object creation, after setting all properties.
490function popupmenu_file_CreateFcn(hObject, eventdata, handles)
491% hObject    handle to popupmenu_file (see GCBO)
492% eventdata  reserved - to be defined in a future version of MATLAB
493% handles    empty - handles not created until after all CreateFcns called
494
495% Hint: popupmenu controls usually have a white background on Windows.
496%       See ISPC and COMPUTER.
497if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
498    set(hObject,'BackgroundColor','white');
499end
500
501
502
503
504% --- Executes on button press in checkbox_Q2.
505function checkbox_Q2_Callback(hObject, eventdata, handles)
506% hObject    handle to checkbox_Q2 (see GCBO)
507% eventdata  reserved - to be defined in a future version of MATLAB
508% handles    structure with handles and user data (see GUIDATA)
509
510% Hint: get(hObject,'Value') returns toggle state of checkbox_Q2
511
512set(handles.checkbox_all,'Value',0);
513set(handles.checkbox_none,'Value',0);
514
515% --- Executes on button press in checkbox_Q3.
516function checkbox_Q3_Callback(hObject, eventdata, handles)
517% hObject    handle to checkbox_Q3 (see GCBO)
518% eventdata  reserved - to be defined in a future version of MATLAB
519% handles    structure with handles and user data (see GUIDATA)
520
521% Hint: get(hObject,'Value') returns toggle state of checkbox_Q3
522
523set(handles.checkbox_all,'Value',0);
524set(handles.checkbox_none,'Value',0);
525
526% --- Executes on button press in checkbox_Q4.
527function checkbox_Q4_Callback(hObject, eventdata, handles)
528% hObject    handle to checkbox_Q4 (see GCBO)
529% eventdata  reserved - to be defined in a future version of MATLAB
530% handles    structure with handles and user data (see GUIDATA)
531
532% Hint: get(hObject,'Value') returns toggle state of checkbox_Q4
533
534set(handles.checkbox_all,'Value',0);
535set(handles.checkbox_none,'Value',0);
536
537% --- Executes on button press in checkbox_Q5.
538function checkbox_Q5_Callback(hObject, eventdata, handles)
539% hObject    handle to checkbox_Q5 (see GCBO)
540% eventdata  reserved - to be defined in a future version of MATLAB
541% handles    structure with handles and user data (see GUIDATA)
542
543% Hint: get(hObject,'Value') returns toggle state of checkbox_Q5
544
545set(handles.checkbox_all,'Value',0);
546set(handles.checkbox_none,'Value',0);
547
548% --- Executes on button press in checkbox_Q6.
549function checkbox_Q6_Callback(hObject, eventdata, handles)
550% hObject    handle to checkbox_Q6 (see GCBO)
551% eventdata  reserved - to be defined in a future version of MATLAB
552% handles    structure with handles and user data (see GUIDATA)
553
554% Hint: get(hObject,'Value') returns toggle state of checkbox_Q6
555
556set(handles.checkbox_all,'Value',0);
557set(handles.checkbox_none,'Value',0);
558
559% --- Executes on button press in checkbox_Q7.
560function checkbox_Q7_Callback(hObject, eventdata, handles)
561% hObject    handle to checkbox_Q7 (see GCBO)
562% eventdata  reserved - to be defined in a future version of MATLAB
563% handles    structure with handles and user data (see GUIDATA)
564
565% Hint: get(hObject,'Value') returns toggle state of checkbox_Q7
566
567set(handles.checkbox_all,'Value',0);
568set(handles.checkbox_none,'Value',0);
569
570% --- Executes on button press in checkbox_Q8.
571function checkbox_Q8_Callback(hObject, eventdata, handles)
572% hObject    handle to checkbox_Q8 (see GCBO)
573% eventdata  reserved - to be defined in a future version of MATLAB
574% handles    structure with handles and user data (see GUIDATA)
575
576% Hint: get(hObject,'Value') returns toggle state of checkbox_Q8
577
578set(handles.checkbox_all,'Value',0);
579set(handles.checkbox_none,'Value',0);
580
581% --- Executes on button press in checkbox_Q9.
582function checkbox_Q9_Callback(hObject, eventdata, handles)
583% hObject    handle to checkbox_Q9 (see GCBO)
584% eventdata  reserved - to be defined in a future version of MATLAB
585% handles    structure with handles and user data (see GUIDATA)
586
587% Hint: get(hObject,'Value') returns toggle state of checkbox_Q9
588
589set(handles.checkbox_all,'Value',0);
590set(handles.checkbox_none,'Value',0);
591
592% --- Executes on button press in checkbox_Q10.
593function checkbox_Q10_Callback(hObject, eventdata, handles)
594% hObject    handle to checkbox_Q10 (see GCBO)
595% eventdata  reserved - to be defined in a future version of MATLAB
596% handles    structure with handles and user data (see GUIDATA)
597
598% Hint: get(hObject,'Value') returns toggle state of checkbox_Q10
599
600set(handles.checkbox_all,'Value',0);
601set(handles.checkbox_none,'Value',0);
602
603% --- Executes on button press in checkbox_S1.
604function checkbox_S1_Callback(hObject, eventdata, handles)
605% hObject    handle to checkbox_S1 (see GCBO)
606% eventdata  reserved - to be defined in a future version of MATLAB
607% handles    structure with handles and user data (see GUIDATA)
608
609% Hint: get(hObject,'Value') returns toggle state of checkbox_S1
610
611set(handles.checkbox_all,'Value',0);
612set(handles.checkbox_none,'Value',0);
613
614% --- Executes on button press in checkbox_S2.
615function checkbox_S2_Callback(hObject, eventdata, handles)
616% hObject    handle to checkbox_S2 (see GCBO)
617% eventdata  reserved - to be defined in a future version of MATLAB
618% handles    structure with handles and user data (see GUIDATA)
619
620% Hint: get(hObject,'Value') returns toggle state of checkbox_S2
621
622set(handles.checkbox_all,'Value',0);
623set(handles.checkbox_none,'Value',0);
624
625% --- Executes on button press in checkbox_S2.
626function checkbox_S3_Callback(hObject, eventdata, handles)
627% hObject    handle to checkbox_S3 (see GCBO)
628% eventdata  reserved - to be defined in a future version of MATLAB
629% handles    structure with handles and user data (see GUIDATA)
630
631% Hint: get(hObject,'Value') returns toggle state of checkbox_S3
632
633
634% --- Executes on button press in checkbox_S4.
635function checkbox_S4_Callback(hObject, eventdata, handles)
636% hObject    handle to checkbox_S4 (see GCBO)
637% eventdata  reserved - to be defined in a future version of MATLAB
638% handles    structure with handles and user data (see GUIDATA)
639
640% Hint: get(hObject,'Value') returns toggle state of checkbox_S4
641
642set(handles.checkbox_all,'Value',0);
643set(handles.checkbox_none,'Value',0);
644
645% --- Executes on button press in checkbox_S5.
646function checkbox_S5_Callback(hObject, eventdata, handles)
647% hObject    handle to checkbox_S5 (see GCBO)
648% eventdata  reserved - to be defined in a future version of MATLAB
649% handles    structure with handles and user data (see GUIDATA)
650
651% Hint: get(hObject,'Value') returns toggle state of checkbox_S5
652
653set(handles.checkbox_all,'Value',0);
654set(handles.checkbox_none,'Value',0);
655
656% --- Executes on button press in checkbox_S6.
657function checkbox_S6_Callback(hObject, eventdata, handles)
658% hObject    handle to checkbox_S6 (see GCBO)
659% eventdata  reserved - to be defined in a future version of MATLAB
660% handles    structure with handles and user data (see GUIDATA)
661
662% Hint: get(hObject,'Value') returns toggle state of checkbox_S6
663
664set(handles.checkbox_all,'Value',0);
665set(handles.checkbox_none,'Value',0);
666
667% --- Executes on button press in checkbox_S7.
668function checkbox_S7_Callback(hObject, eventdata, handles)
669% hObject    handle to checkbox_S7 (see GCBO)
670% eventdata  reserved - to be defined in a future version of MATLAB
671% handles    structure with handles and user data (see GUIDATA)
672
673% Hint: get(hObject,'Value') returns toggle state of checkbox_S7
674
675set(handles.checkbox_all,'Value',0);
676set(handles.checkbox_none,'Value',0);
677
678% --- Executes on button press in checkbox_S8.
679function checkbox_S8_Callback(hObject, eventdata, handles)
680% hObject    handle to checkbox_S8 (see GCBO)
681% eventdata  reserved - to be defined in a future version of MATLAB
682% handles    structure with handles and user data (see GUIDATA)
683
684% Hint: get(hObject,'Value') returns toggle state of checkbox_S8
685
686set(handles.checkbox_all,'Value',0);
687set(handles.checkbox_none,'Value',0);
688
689% --- Executes on button press in checkbox_S9.
690function checkbox_S9_Callback(hObject, eventdata, handles)
691% hObject    handle to checkbox_S9 (see GCBO)
692% eventdata  reserved - to be defined in a future version of MATLAB
693% handles    structure with handles and user data (see GUIDATA)
694
695% Hint: get(hObject,'Value') returns toggle state of checkbox_S9
696
697set(handles.checkbox_all,'Value',0);
698set(handles.checkbox_none,'Value',0);
699
700% --- Executes on button press in checkbox_S11.
701function checkbox_S11_Callback(hObject, eventdata, handles)
702% hObject    handle to checkbox_S11 (see GCBO)
703% eventdata  reserved - to be defined in a future version of MATLAB
704% handles    structure with handles and user data (see GUIDATA)
705
706% Hint: get(hObject,'Value') returns toggle state of checkbox_S11
707set(handles.checkbox_all,'Value',0);
708set(handles.checkbox_none,'Value',0);
709
710
711% --- Executes on button press in checkbox_S12.
712function checkbox_S12_Callback(hObject, eventdata, handles)
713% hObject    handle to checkbox_S12 (see GCBO)
714% eventdata  reserved - to be defined in a future version of MATLAB
715% handles    structure with handles and user data (see GUIDATA)
716
717% Hint: get(hObject,'Value') returns toggle state of checkbox_S12
718set(handles.checkbox_all,'Value',0);
719set(handles.checkbox_none,'Value',0);
720
721% --- Executes on button press in checkbox_S10.
722function checkbox_S10_Callback(hObject, eventdata, handles)
723% hObject    handle to checkbox_S10 (see GCBO)
724% eventdata  reserved - to be defined in a future version of MATLAB
725% handles    structure with handles and user data (see GUIDATA)
726
727% Hint: get(hObject,'Value') returns toggle state of checkbox_S10
728
729set(handles.checkbox_all,'Value',0);
730set(handles.checkbox_none,'Value',0);
731
732% --- Executes on button press in checkbox_AllQuad.
733function checkbox_AllQuad_Callback(hObject, eventdata, handles)
734% hObject    handle to checkbox_AllQuad (see GCBO)
735% eventdata  reserved - to be defined in a future version of MATLAB
736% handles    structure with handles and user data (see GUIDATA)
737
738% Hint: get(hObject,'Value') returns toggle state of checkbox_AllQuad
739
740set(handles.checkbox_all,'Value',0);
741set(handles.checkbox_none,'Value',0);
742val = get(handles.checkbox_AllQuad,'Value');
743
744% Selection of number for families depending on the config
745switch handles.configmode
746    case 'confignominal'
747        kQmax = 10;
748        kSmax = 10;
749    case 'configS11'
750        kQmax = 10;
751        kSmax = 11;
752    case 'confignano'
753        kQmax = 12;
754        kSmax = 11;
755end
756
757if val
758    set(handles.checkbox_noneQuad,'Value',0);     
759    for k = 1:kQmax,
760        Name = strcat('Q',num2str(k));
761        set(handles.(['checkbox_',Name]),'Enable','off')
762        set(handles.(['checkbox_',Name]),'Value',1)
763    end
764   
765    % exclure la montee des dipoles et sextus
766    for k = 1:kSmax
767        Name = strcat('S',num2str(k));
768        set(handles.(['checkbox_',Name]),'Enable','off')
769    end
770    set(handles.checkbox_AllSextu,'Enable','off');
771    set(handles.checkbox_BEND,'Enable','off');
772end
773
774% --- Executes on button press in checkbox_AllSextu.
775function checkbox_AllSextu_Callback(hObject, eventdata, handles)
776% hObject    handle to checkbox_AllSextu (see GCBO)
777% eventdata  reserved - to be defined in a future version of MATLAB
778% handles    structure with handles and user data (see GUIDATA)
779
780% Hint: get(hObject,'Value') returns toggle state of checkbox_AllSextu
781
782set(handles.checkbox_all,'Value',0);
783set(handles.checkbox_none,'Value',0);
784val = get(handles.checkbox_AllSextu,'Value');
785
786% Selection of number for families depending on the config
787switch handles.configmode
788    case 'confignominal'
789        kQmax = 10;
790        kSmax = 10;
791    case 'configS11'
792        kQmax = 10;
793        kSmax = 11;
794    case 'confignano'
795        kQmax = 12;
796        kSmax = 11;
797end
798
799if val
800    set(handles.checkbox_NoneSextu,'Value',0);   
801     
802    for k = 1:kSmax,
803        Name = strcat('S',num2str(k));
804        set(handles.(['checkbox_',Name]),'Enable','off');
805        set(handles.(['checkbox_',Name]),'Value',1)
806    end
807    % Disable cycling on quad and dipole
808    for k = 1:kQmax,
809        Name = strcat('Q',num2str(k));
810        set(handles.(['checkbox_',Name]),'Enable','off')
811    end
812    set(handles.checkbox_AllQuad,'Enable','off');
813    set(handles.checkbox_BEND,'Enable','off');
814
815else
816   
817    for k = 1:kSmax,
818        Name = strcat('S',num2str(k));
819        set(handles.(['checkbox_',Name]),'Enable','on')
820    end
821    % rendre possible la montee des dipoles et quad
822    for k = 1:kQmax,
823        Name = strcat('Q',num2str(k));
824        set(handles.(['checkbox_',Name]),'Enable','on')
825    end
826    set(handles.checkbox_AllQuad,'Enable','on');
827    set(handles.checkbox_BEND,'Enable','on');
828end
829
830
831
832% --- Executes on button press in courbe_pushbutton.
833function courbe_pushbutton_Callback(hObject, eventdata, handles)
834% hObject    handle to courbe_pushbutton (see GCBO)
835% eventdata  reserved - to be defined in a future version of MATLAB
836% handles    structure with handles and user data (see GUIDATA)
837
838% valBEND = get(handles.checkbox_BEND,'Value');
839% valQ1 = get(handles.checkbox_Q1,'Value');valQ2 = get(handles.checkbox_Q2,'Value');
840% valQ3 = get(handles.checkbox_Q3,'Value');valQ4 = get(handles.checkbox_Q4,'Value');
841% valQ5 = get(handles.checkbox_Q5,'Value');valQ6 = get(handles.checkbox_Q6,'Value');
842% valQ7 = get(handles.checkbox_Q7,'Value');valQ8 = get(handles.checkbox_Q8,'Value');
843% valQ9 = get(handles.checkbox_Q9,'Value');valQ10 = get(handles.checkbox_Q10,'Value');
844% valQtous = get(handles.checkbox_AllQuad,'Value');
845% valS1 = get(handles.checkbox_S1,'Value');valS2 = get(handles.checkbox_S2,'Value');
846% valQ3 = get(handles.checkbox_S3,'Value');valS4 = get(handles.checkbox_S4,'Value');
847% valS5 = get(handles.checkbox_S5,'Value');valS6 = get(handles.checkbox_S6,'Value');
848% valS7 = get(handles.checkbox_S7,'Value');valS8 = get(handles.checkbox_S8,'Value');
849% valS9 = get(handles.checkbox_S9,'Value');valS10 = get(handles.checkbox_S10,'Value');
850% valStous = get(handles.checkbox_AllSextu,'Value');
851% %valeurs = [valQ1 valQ2 valQ3 valQ4 valQ5 valQ6 valQ7 valQ8 valQ9 valQ10 valQtous];
852% test = ones(11,1)'*0;
853
854%  for i = 1:10
855%       name = strcat('valQ',num2str(i))
856%        if eval(name)
857
858name=['axes' num2str(1)];
859axes(handles.(name));
860
861Family={'BEND', 'HCOR', 'VCOR',...
862    'Q1','Q2','Q3','Q4','Q5',...
863    'Q6','Q7','Q8','Q9','Q10',...
864    'Q11','Q12', ...
865    'S1','S2','S3','S4','S5',...
866    'S6','S7','S8','S9','S10', ...
867    'S11', 'S12'};   
868   
869hold off;
870
871for k =1:length(Family)
872    if get(handles.(['checkbox_',Family{k}]),'Value')
873        Name = strcat('Cycle',Family{k});
874        %Name = Family{k};
875
876        %vect = getfamilydata(Name,'DeviceName');
877        vect = family2tangodev(Name);
878        if ~iscell(vect)
879            vect = {vect};
880        end
881        if strcmp(handles.mode,'1element')
882            jend = 1;
883        elseif strcmp(handles.mode,'lafamille')
884            jend = length(vect);
885        end
886
887        % plot de la courbe de cyclage du premier element magnetique de la
888        % famille)
889        for j = 1:jend
890            curve = getcyclecurve(vect{j});
891
892            if iscell(curve)
893                for k=1:length(curve),
894                    n = size(curve{k}.Data,1);
895                    % time vector
896                    cums = cumsum(curve{k}.Data(:,2))';
897                    x = [cums; cums];
898                    x = reshape(x,1,2*n);
899                    x = [0 x(1:end-1)];
900
901                    % amplitude vector
902                    y = [curve{k}.Data(:,1),curve{k}.Data(:,1)]';
903                    y = reshape(y,1,2*n);
904                   
905                    plot(x,y,'b.-');
906                    xlabel('Temps (s)');
907                    ylabel('Courant [A]');
908                    ylim([min(y) max(y)*1.05]);
909                    title(['Cycling curve for ' curve{k}.DeviceName]);
910                    grid on
911                end
912            else
913                n = size(curve,1);
914                % time vector
915                cums = cumsum(curve(:,2))';
916                x = [cums; cums];
917                x = reshape(x,1,2*n);
918                x = [0 x(1:end-1)];
919
920                % amplitude vector
921                y = [curve(:,1),curve(:,1)]';
922                y = reshape(y,1,2*n);
923
924
925                plot(x,y,'b.-');
926                xlabel('Temps (s)');
927                ylabel('Courant [A]');
928                ylim([min(y)*1.1 max(y)*1.1]);
929                title('Courbe de cyclage');
930                grid on
931            end
932            hold on
933        end
934        hold on
935    end
936end
937
938
939
940% --- Executes on button press in checkbox_QC13.
941function checkbox_QC13_Callback(hObject, eventdata, handles)
942% hObject    handle to checkbox_QC13 (see GCBO)
943% eventdata  reserved - to be defined in a future version of MATLAB
944% handles    structure with handles and user data (see GUIDATA)
945
946% Hint: get(hObject,'Value') returns toggle state of checkbox_QC13
947
948set(handles.checkbox_all,'Value',0);
949set(handles.checkbox_none,'Value',0);
950val = get(handles.checkbox_QC13,'Value');
951
952
953% --- Executes on button press in pushbutton_singledevice.
954function pushbutton_singledevice_Callback(hObject, eventdata, handles)
955% hObject    handle to pushbutton_singledevice (see GCBO)
956% eventdata  reserved - to be defined in a future version of MATLAB
957% handles    structure with handles and user data (see GUIDATA)
958
959
960function uibuttongroup_SelectionChangeFcn(hObject,eventdata,handles)
961% hObject    handle to uipanel1 (see GCBO)
962% eventdata  reserved - to be defined in a future version of MATLAB
963% handles    structure with handles and user data (see GUIDATA)
964
965switch get(get(hObject,'SelectedObject'),'Tag')  % Get Tag of selected object
966    case 'radiobutton1'
967        % code piece when radiobutton1 is selected goes here
968        % 'Mode' = 'Simulation';
969        handles.mode = '1element';
970       
971    case 'radiobutton2'
972        % code piece when radiobutton_configS11 is selected goes here
973        % '.Mode' = 'Machine';
974        handles.mode = 'lafamille';
975end
976% Update handles structure
977guidata(hObject, handles);
978
979
980% --- Executes on button press in checkbox_noneQuad.
981function checkbox_noneQuad_Callback(hObject, eventdata, handles)
982% hObject    handle to checkbox_noneQuad (see GCBO)
983% eventdata  reserved - to be defined in a future version of MATLAB
984% handles    structure with handles and user data (see GUIDATA)
985
986% Hint: get(hObject,'Value') returns toggle state of checkbox_noneQuad
987
988set(handles.checkbox_all,'Value',0);
989set(handles.checkbox_none,'Value',0);
990val = get(handles.checkbox_noneQuad,'Value');
991
992if val
993    set(handles.checkbox_AllQuad,'Value',0);
994    for k = 1:length(findmemberof('QUAD'))
995        Name = strcat('Q',num2str(k));
996        set(handles.(['checkbox_',Name]),'Enable','on')
997        set(handles.(['checkbox_',Name]),'Value',0)
998    end
999
1000    % rendre possible la montee des dipoles et sextus
1001    for k = 1:length(findmemberof('SEXT'))
1002        Name = strcat('S',num2str(k));
1003        set(handles.(['checkbox_',Name]),'Enable','on')
1004    end
1005    set(handles.checkbox_AllSextu,'Enable','on');
1006    set(handles.checkbox_BEND,'Enable','on');
1007end
1008
1009
1010% --- Executes on button press in checkbox_NoneSextu.
1011function checkbox_NoneSextu_Callback(hObject, eventdata, handles)
1012% hObject    handle to checkbox_NoneSextu (see GCBO)
1013% eventdata  reserved - to be defined in a future version of MATLAB
1014% handles    structure with handles and user data (see GUIDATA)
1015
1016% Hint: get(hObject,'Value') returns toggle state of checkbox_NoneSextu
1017
1018set(handles.checkbox_all,'Value',0);
1019set(handles.checkbox_none,'Value',0);
1020val = get(handles.checkbox_NoneSextu,'Value');
1021
1022if val
1023    set(handles.checkbox_AllSextu,'Value',0);   
1024    for k = 1:length(findmemberof('SEXT'))
1025        Name = strcat('S',num2str(k));
1026        set(handles.(['checkbox_',Name]),'Enable','on')
1027        set(handles.(['checkbox_',Name]),'Value',0)
1028    end
1029
1030    % Enable cycling of quads abd dipole
1031    for k = 1:length(findmemberof('QUAD'))
1032        Name = strcat('Q',num2str(k));
1033        set(handles.(['checkbox_',Name]),'Enable','on')
1034    end
1035    set(handles.checkbox_AllQuad,'Enable','on');
1036    set(handles.checkbox_BEND,'Enable','on');
1037end
1038
1039
1040% --- Executes on button press in checkbox_Q11.
1041function checkbox_Q11_Callback(hObject, eventdata, handles)
1042% hObject    handle to checkbox_Q11 (see GCBO)
1043% eventdata  reserved - to be defined in a future version of MATLAB
1044% handles    structure with handles and user data (see GUIDATA)
1045
1046% Hint: get(hObject,'Value') returns toggle state of checkbox_Q11
1047set(handles.checkbox_all,'Value',0);
1048set(handles.checkbox_none,'Value',0);
1049
1050
1051% --- Executes on button press in checkbox_Q12.
1052function checkbox_Q12_Callback(hObject, eventdata, handles)
1053% hObject    handle to checkbox_Q12 (see GCBO)
1054% eventdata  reserved - to be defined in a future version of MATLAB
1055% handles    structure with handles and user data (see GUIDATA)
1056
1057% Hint: get(hObject,'Value') returns toggle state of checkbox_Q12
1058set(handles.checkbox_all,'Value',0);
1059set(handles.checkbox_none,'Value',0);
1060
1061
1062
1063
1064% --- Executes on button press in pushbutton_CyclingStatus.
1065function pushbutton_CyclingStatus_Callback(hObject, eventdata, handles)
1066% hObject    handle to pushbutton_CyclingStatus (see GCBO)
1067% eventdata  reserved - to be defined in a future version of MATLAB
1068% handles    structure with handles and user data (see GUIDATA)
1069
1070Families={'BEND', 'HCOR', 'VCOR', 'QT', ...
1071    'Q1','Q2','Q3','Q4','Q5',...
1072    'Q6','Q7','Q8','Q9','Q10',...
1073    'Q11','Q12', ...
1074    'S1','S2','S3','S4','S5',...
1075    'S6','S7','S8','S9','S10', ...
1076    'S11','S12', ...
1077    };   
1078
1079FamilyNumber = length(Families);
1080
1081totalProgression = zeros(1, FamilyNumber);
1082
1083for k1=1:FamilyNumber,
1084    CycleFamily = ['Cycle' Families{k1}];
1085    [CycleIndex, CycleAO] = isfamily(CycleFamily);   
1086    totalProgression(k1) =  mean(tango_group_read_attribute2(CycleAO.GroupId,'totalProgression'));
1087end
1088%
1089fprintf('\nCycling state, %s\n',datestr(now))
1090for k1=1:FamilyNumber,
1091    fprintf('Family %s, cycling state: %03.0f %%\t', Families{k1}, totalProgression(k1))
1092    if k1~=1 && mod(k1+1,2) ,
1093        fprintf('\n')
1094    end
1095end
1096
1097
1098% --- Executes on selection change in popupmenu_singledevice.
1099function popupmenu_singledevice_Callback(hObject, eventdata, handles)
1100% hObject    handle to popupmenu_singledevice (see GCBO)
1101% eventdata  reserved - to be defined in a future version of MATLAB
1102% handles    structure with handles and user data (see GUIDATA)
1103
1104% Hints: contents = get(hObject,'String') returns popupmenu_singledevice contents as cell array
1105%        contents{get(hObject,'Value')} returns selected item from popupmenu_singledevice
1106
1107
1108% --- Executes during object creation, after setting all properties.
1109function popupmenu_singledevice_CreateFcn(hObject, eventdata, handles)
1110% hObject    handle to popupmenu_singledevice (see GCBO)
1111% eventdata  reserved - to be defined in a future version of MATLAB
1112% handles    empty - handles not created until after all CreateFcns called
1113
1114% Hint: popupmenu controls usually have a white background on Windows.
1115%       See ISPC and COMPUTER.
1116if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1117    set(hObject,'BackgroundColor','white');
1118end
1119
1120set(hObject, 'String', family2tangodev('Qall'));
1121
1122
1123% --- Executes on button press in pushbutton_FFWD_ON.
1124function pushbutton_FFWD_ON_Callback(hObject, eventdata, handles)
1125% hObject    handle to pushbutton_FFWD_ON (see GCBO)
1126% eventdata  reserved - to be defined in a future version of MATLAB
1127% handles    structure with handles and user data (see GUIDATA)
1128writeattribute('ans/ei/nuffwd/booleanResult', uint8(1));
1129pushbutton_FFWDStatus_Callback(hObject, eventdata, handles);
1130
1131% --- Executes on button press in pushbutton_FFWD_OFF.
1132function pushbutton_FFWD_OFF_Callback(hObject, eventdata, handles)
1133% hObject    handle to pushbutton_FFWD_OFF (see GCBO)
1134% eventdata  reserved - to be defined in a future version of MATLAB
1135% handles    structure with handles and user data (see GUIDATA)
1136writeattribute('ans/ei/nuffwd/booleanResult', uint8(0));
1137pushbutton_FFWDStatus_Callback(hObject, eventdata, handles);
1138
1139% --- Executes on button press in pushbutton_FFWDStatus.
1140function pushbutton_FFWDStatus_Callback(hObject, eventdata, handles)
1141% hObject    handle to pushbutton_FFWDStatus (see GCBO)
1142% eventdata  reserved - to be defined in a future version of MATLAB
1143% handles    structure with handles and user data (see GUIDATA)
1144set(handles.checkbox_FFWD_STATUS, 'Enable', 'Off');
1145pause(3)
1146FFWDFlag = readattribute('ans/ei/nuffwd/booleanResult');
1147% any(getpv({'Q1','Q2', 'Q3', 'Q4', 'Q5', ...
1148%     'Q6','Q7', 'Q8', 'Q9', 'Q10'}, 'SumOffset') ~= 0)
1149set(handles.checkbox_FFWD_STATUS, 'Value', FFWDFlag);
1150set(handles.checkbox_FFWD_STATUS, 'Enable', 'On');
1151
1152
1153% --- Executes on button press in pushbutton_offset2zero.
1154function pushbutton_offset2zero_Callback(hObject, eventdata, handles)
1155% hObject    handle to pushbutton_offset2zero (see GCBO)
1156% eventdata  reserved - to be defined in a future version of MATLAB
1157% handles    structure with handles and user data (see GUIDATA)
1158
1159Answer = questdlg('Forcing Offsets of quadrupole magnets to zero (no: cancel)', 'Confirmation box','Yes','No','No');
1160if strcmpi(Answer, 'No')
1161    %
1162else
1163    setquadoffset2zero
1164end
1165       
1166% --- Executes on button press in pushbutton_plotoffset.
1167function pushbutton_plotoffset_Callback(hObject, eventdata, handles)
1168% hObject    handle to pushbutton_plotoffset (see GCBO)
1169% eventdata  reserved - to be defined in a future version of MATLAB
1170% handles    structure with handles and user data (see GUIDATA)
1171
1172plotquad('Offset1','NoMean')
1173
1174% --- Executes on button press in pushbutton_plotcurrentPM.
1175function pushbutton_plotcurrentPM_Callback(hObject, eventdata, handles)
1176% hObject    handle to pushbutton_plotcurrentPM (see GCBO)
1177% eventdata  reserved - to be defined in a future version of MATLAB
1178% handles    structure with handles and user data (see GUIDATA)
1179
1180plotquad('Setpoint','NoMean')
1181
1182
1183% --- Executes on button press in pushbutton_current.
1184function pushbutton_current_Callback(hObject, eventdata, handles)
1185% hObject    handle to pushbutton_current (see GCBO)
1186% eventdata  reserved - to be defined in a future version of MATLAB
1187% handles    structure with handles and user data (see GUIDATA)
1188
1189plotquad('Mean')
1190plotquad('NoMean')
1191
1192
1193% --- Executes when selected object is changed in uipanel_gestionConfig.
1194function uipanel_gestionConfig_SelectionChangeFcn(hObject, eventdata, handles)
1195% hObject    handle to the selected object in uipanel_gestionConfig
1196% eventdata  structure with the following fields (see UIBUTTONGROUP)
1197%       EventName: string 'SelectionChanged' (read only)
1198%       OldValue: handle of the previously selected object or empty if none was selected
1199%       NewValue: handle of the currently selected object
1200% handles    structure with handles and user data (see GUIDATA)
1201
1202switch get(hObject,'Tag')  % Get Tag of selected object
1203    case 'radiobutton_confignominal'
1204        % code piece when radiobutton1 is selected goes here
1205        handles.configmode = 'confignominal';
1206       
1207    case 'radiobutton_configS11'
1208        % code piece when radiobutton_configS11 is selected goes here
1209        handles.configmode = 'configS11';
1210
1211    case 'radiobutton_confignano'
1212        % code piece when radiobutton_configS11 is selected goes here
1213        handles.configmode = 'confignano';
1214end
1215% Update handles structure
1216guidata(hObject, handles);
1217
1218
1219% --- Executes on button press in checkbox_QT.
1220function checkbox_QT_Callback(hObject, eventdata, handles)
1221% hObject    handle to checkbox_QT (see GCBO)
1222% eventdata  reserved - to be defined in a future version of MATLAB
1223% handles    structure with handles and user data (see GUIDATA)
1224
1225% Hint: get(hObject,'Value') returns toggle state of checkbox_QT
Note: See TracBrowser for help on using the repository browser.