source: MML/trunk/machine/SOLEIL/StorageRing/FOFB/FOFB_defauts.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 13.2 KB
Line 
1function varargout = FOFB_defauts(varargin)
2% FOFB_DEFAUTS M-file for FOFB_defauts.fig
3%      FOFB_DEFAUTS, by itself, creates a new FOFB_DEFAUTS or raises the existing
4%      singleton*.
5%
6%      H = FOFB_DEFAUTS returns the handle to a new FOFB_DEFAUTS or the handle to
7%      the existing singleton*.
8%
9%      FOFB_DEFAUTS('CALLBACK',hObject,eventData,handles,...) calls the local
10%      function named CALLBACK in FOFB_DEFAUTS.M with the given input arguments.
11%
12%      FOFB_DEFAUTS('Property','Value',...) creates a new FOFB_DEFAUTS or raises the
13%      existing singleton*.  Starting from the left, property value pairs are
14%      applied to the GUI before FOFB_defauts_OpeningFunction gets called.  An
15%      unrecognized property name or invalid value makes property application
16%      stop.  All inputs are passed to FOFB_defauts_OpeningFcn via varargin.
17%
18%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
19%      instance to run (singleton)".
20%
21% See also: GUIDE, GUIDATA, GUIHANDLES
22
23% Edit the above text to modify the response to help FOFB_defauts
24
25% Last Modified by GUIDE v2.5 03-Feb-2009 11:21:17
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', @FOFB_defauts_OpeningFcn, ...
32                   'gui_OutputFcn',  @FOFB_defauts_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 FOFB_defauts is made visible.
48function FOFB_defauts_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 FOFB_defauts (see VARARGIN)
54
55% Choose default command line output for FOFB_defauts
56handles.output = hObject;
57
58% Update handles structure
59guidata(hObject, handles);
60
61% UIWAIT makes FOFB_defauts wait for user response (see UIRESUME)
62% uiwait(handles.figure1);
63attr_list={'processTimeOutOfRange','xOrbitOutOfRange','zOrbitOutOfRange','xCorrectionOutOfRange','zCorrectionOutOfRange','bpmsCountOutOfRange','storageRingCurrentOutOfRange','fofbRecordTimeout','bpmsTangoComError','sniffersTangoComError','steerersTangoComError','dcctTangoComError','serviceLockerComError','logs','fofbErrorStatus'};
64setappdata(handles.figure1,'attr_list',attr_list)
65dev='ANS/DG/FOFB-MANAGER';
66
67result=tango_read_attributes2(dev,attr_list);
68
69set(handles.processTimeOutOfRange,'value',result(1).value);
70set(handles.xOrbitOutOfRange,'value',result(2).value);
71set(handles.zOrbitOutOfRange,'value',result(3).value);
72set(handles.xCorrectionOutOfRange,'value',result(4).value);
73set(handles.zCorrectionOutOfRange,'value',result(5).value);
74set(handles.bpmsCountOutOfRange,'value',result(6).value);
75set(handles.storageRingCurrentOutOfRange,'value',result(7).value);
76set(handles.fofbRecordTimeout,'value',result(8).value);
77set(handles.bpmsTangoComError,'value',result(9).value);
78set(handles.sniffersTangoComError,'value',result(10).value);
79set(handles.steerersTangoComError,'value',result(11).value);
80set(handles.dcctTangoComError,'value',result(12).value);
81set(handles.serviceLockerComError,'value',result(13).value);
82
83% new_text='';
84% for i=1:1:size(result(14).value,2)
85%     new_text=strvcat(new_text,result(14).value{i});
86% end   
87new_text=result(14).value;
88
89set(handles.logs,'string',new_text);
90set(handles.logs,'value',size(new_text,1));
91
92set(handles.fofbErrorStatus,'string',result(15).value);
93
94switch result(15).value
95    case 'no error'
96        set(handles.fofbErrorStatus,'BackgroundColor',[1 1 1]*0.702)
97    otherwise
98        set(handles.fofbErrorStatus,'BackgroundColor','red')
99end
100
101% Count errors
102sum = 0;
103for k=1:13,
104    sum = result(k).value;
105end
106
107% Change color of List defaut
108if sum > 0
109    set(handles.text_list_defaults, 'BackgroundColor', [1 0 0]);
110else
111    set(handles.text_list_defaults, 'BackgroundColor', [0 1 0]);
112end
113
114
115% --- Outputs from this function are returned to the command line.
116function varargout = FOFB_defauts_OutputFcn(hObject, eventdata, handles)
117% varargout  cell array for returning output args (see VARARGOUT);
118% hObject    handle to figure
119% eventdata  reserved - to be defined in a future version of MATLAB
120% handles    structure with handles and user data (see GUIDATA)
121
122% Get default command line output from handles structure
123varargout{1} = handles.output;
124
125
126% --- Executes on button press in processTimeOutOfRange.
127function processTimeOutOfRange_Callback(hObject, eventdata, handles)
128% hObject    handle to processTimeOutOfRange (see GCBO)
129% eventdata  reserved - to be defined in a future version of MATLAB
130% handles    structure with handles and user data (see GUIDATA)
131
132% Hint: get(hObject,'Value') returns toggle state of processTimeOutOfRange
133
134
135% --- Executes on button press in xOrbitOutOfRange.
136function xOrbitOutOfRange_Callback(hObject, eventdata, handles)
137% hObject    handle to xOrbitOutOfRange (see GCBO)
138% eventdata  reserved - to be defined in a future version of MATLAB
139% handles    structure with handles and user data (see GUIDATA)
140
141% Hint: get(hObject,'Value') returns toggle state of xOrbitOutOfRange
142
143
144% --- Executes on button press in zOrbitOutOfRange.
145function zOrbitOutOfRange_Callback(hObject, eventdata, handles)
146% hObject    handle to zOrbitOutOfRange (see GCBO)
147% eventdata  reserved - to be defined in a future version of MATLAB
148% handles    structure with handles and user data (see GUIDATA)
149
150% Hint: get(hObject,'Value') returns toggle state of zOrbitOutOfRange
151
152
153% --- Executes on button press in xCorrectionOutOfRange.
154function xCorrectionOutOfRange_Callback(hObject, eventdata, handles)
155% hObject    handle to xCorrectionOutOfRange (see GCBO)
156% eventdata  reserved - to be defined in a future version of MATLAB
157% handles    structure with handles and user data (see GUIDATA)
158
159% Hint: get(hObject,'Value') returns toggle state of xCorrectionOutOfRange
160
161
162% --- Executes on button press in zCorrectionOutOfRange.
163function zCorrectionOutOfRange_Callback(hObject, eventdata, handles)
164% hObject    handle to zCorrectionOutOfRange (see GCBO)
165% eventdata  reserved - to be defined in a future version of MATLAB
166% handles    structure with handles and user data (see GUIDATA)
167
168% Hint: get(hObject,'Value') returns toggle state of zCorrectionOutOfRange
169
170
171% --- Executes on button press in storageRingCurrentOutOfRange.
172function storageRingCurrentOutOfRange_Callback(hObject, eventdata, handles)
173% hObject    handle to storageRingCurrentOutOfRange (see GCBO)
174% eventdata  reserved - to be defined in a future version of MATLAB
175% handles    structure with handles and user data (see GUIDATA)
176
177% Hint: get(hObject,'Value') returns toggle state of storageRingCurrentOutOfRange
178
179
180% --- Executes on button press in fofbRecordTimeout.
181function fofbRecordTimeout_Callback(hObject, eventdata, handles)
182% hObject    handle to fofbRecordTimeout (see GCBO)
183% eventdata  reserved - to be defined in a future version of MATLAB
184% handles    structure with handles and user data (see GUIDATA)
185
186% Hint: get(hObject,'Value') returns toggle state of fofbRecordTimeout
187
188
189% --- Executes on button press in bpmsTangoComError.
190function bpmsTangoComError_Callback(hObject, eventdata, handles)
191% hObject    handle to bpmsTangoComError (see GCBO)
192% eventdata  reserved - to be defined in a future version of MATLAB
193% handles    structure with handles and user data (see GUIDATA)
194
195% Hint: get(hObject,'Value') returns toggle state of bpmsTangoComError
196
197
198% --- Executes on button press in sniffersTangoComError.
199function sniffersTangoComError_Callback(hObject, eventdata, handles)
200% hObject    handle to sniffersTangoComError (see GCBO)
201% eventdata  reserved - to be defined in a future version of MATLAB
202% handles    structure with handles and user data (see GUIDATA)
203
204% Hint: get(hObject,'Value') returns toggle state of sniffersTangoComError
205
206
207% --- Executes on button press in steerersTangoComError.
208function steerersTangoComError_Callback(hObject, eventdata, handles)
209% hObject    handle to steerersTangoComError (see GCBO)
210% eventdata  reserved - to be defined in a future version of MATLAB
211% handles    structure with handles and user data (see GUIDATA)
212
213% Hint: get(hObject,'Value') returns toggle state of steerersTangoComError
214
215
216% --- Executes on button press in dcctTangoComError.
217function dcctTangoComError_Callback(hObject, eventdata, handles)
218% hObject    handle to dcctTangoComError (see GCBO)
219% eventdata  reserved - to be defined in a future version of MATLAB
220% handles    structure with handles and user data (see GUIDATA)
221
222% Hint: get(hObject,'Value') returns toggle state of dcctTangoComError
223
224
225% --- Executes on button press in serviceLockerComError.
226function serviceLockerComError_Callback(hObject, eventdata, handles)
227% hObject    handle to serviceLockerComError (see GCBO)
228% eventdata  reserved - to be defined in a future version of MATLAB
229% handles    structure with handles and user data (see GUIDATA)
230
231% Hint: get(hObject,'Value') returns toggle state of serviceLockerComError
232
233
234% --- Executes on button press in Aknowledge.
235function Aknowledge_Callback(hObject, eventdata, handles)
236% hObject    handle to Aknowledge (see GCBO)
237% eventdata  reserved - to be defined in a future version of MATLAB
238% handles    structure with handles and user data (see GUIDATA)
239attr_list=getappdata(handles.figure1,'attr_list');
240dev='ANS/DG/FOFB-MANAGER';
241tango_command_inout2(dev,'AcknowledgeError');
242pause(1)
243result=tango_read_attributes2(dev,attr_list);
244
245set(handles.processTimeOutOfRange,'value',result(1).value);
246set(handles.xOrbitOutOfRange,'value',result(2).value);
247set(handles.zOrbitOutOfRange,'value',result(3).value);
248set(handles.xCorrectionOutOfRange,'value',result(4).value);
249set(handles.zCorrectionOutOfRange,'value',result(5).value);
250set(handles.bpmsCountOutOfRange,'value',result(6).value);
251set(handles.storageRingCurrentOutOfRange,'value',result(7).value);
252set(handles.fofbRecordTimeout,'value',result(8).value);
253set(handles.bpmsTangoComError,'value',result(9).value);
254set(handles.sniffersTangoComError,'value',result(10).value);
255set(handles.steerersTangoComError,'value',result(11).value);
256set(handles.dcctTangoComError,'value',result(12).value);
257set(handles.serviceLockerComError,'value',result(13).value);
258
259% new_text='';
260% for i=1:1:size(result(14).value,2)
261%     new_text=strvcat(new_text,result(14).value{i});
262% end   
263new_text = result(14).value;
264set(handles.logs,'string',new_text);
265set(handles.logs,'value',size(new_text,1));
266
267set(handles.fofbErrorStatus,'string',result(15).value);
268
269switch result(15).value
270    case 'no error'
271        set(handles.fofbErrorStatus,'BackgroundColor',[1 1 1]*0.702)
272    otherwise
273        set(handles.fofbErrorStatus,'BackgroundColor','red')
274end
275 
276set(handles.text_date_acquitter,'String', datestr(clock));
277
278% Count errors
279sum = 0;
280for k=1:13,
281    sum = result(k).value;
282end
283
284% Change color of List defaut
285if sum > 0
286    set(handles.text_list_defaults, 'BackgroundColor', [1 0 0]);
287else
288    set(handles.text_list_defaults, 'BackgroundColor', [0 1 0]);
289end
290
291
292% --- Executes on button press in close.
293function close_Callback(hObject, eventdata, handles)
294% hObject    handle to close (see GCBO)
295% eventdata  reserved - to be defined in a future version of MATLAB
296% handles    structure with handles and user data (see GUIDATA)
297close(handles.figure1)
298
299
300% --- Executes on button press in bpmsCountOutOfRange.
301function bpmsCountOutOfRange_Callback(hObject, eventdata, handles)
302% hObject    handle to bpmsCountOutOfRange (see GCBO)
303% eventdata  reserved - to be defined in a future version of MATLAB
304% handles    structure with handles and user data (see GUIDATA)
305
306% Hint: get(hObject,'Value') returns toggle state of bpmsCountOutOfRange
307
308
309% --- Executes on selection change in logs.
310function logs_Callback(hObject, eventdata, handles)
311% hObject    handle to logs (see GCBO)
312% eventdata  reserved - to be defined in a future version of MATLAB
313% handles    structure with handles and user data (see GUIDATA)
314
315% Hints: contents = get(hObject,'String') returns logs contents as cell array
316%        contents{get(hObject,'Value')} returns selected item from logs
317
318
319% --- Executes during object creation, after setting all properties.
320function logs_CreateFcn(hObject, eventdata, handles)
321% hObject    handle to logs (see GCBO)
322% eventdata  reserved - to be defined in a future version of MATLAB
323% handles    empty - handles not created until after all CreateFcns called
324
325% Hint: listbox controls usually have a white background on Windows.
326%       See ISPC and COMPUTER.
327if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
328    set(hObject,'BackgroundColor','white');
329end
330
331
332% --- Executes during object creation, after setting all properties.
333function text_date_acquitter_CreateFcn(hObject, eventdata, handles)
334% hObject    handle to text_date_acquitter (see GCBO)
335% eventdata  reserved - to be defined in a future version of MATLAB
336% handles    empty - handles not created until after all CreateFcns called
337
338set(hObject,'String', datestr(clock));
339
340
Note: See TracBrowser for help on using the repository browser.