source: MML/trunk/machine/SOLEIL/common/synchro/kicker_scaling.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 13.9 KB
Line 
1function varargout = kicker_scaling(varargin)
2% KICKER_SCALING M-file for kicker_scaling.fig
3%      KICKER_SCALING, by itself, creates a new KICKER_SCALING or raises the existing
4%      singleton*.
5%
6%      H = KICKER_SCALING returns the handle to a new KICKER_SCALING or the handle to
7%      the existing singleton*.
8%
9%      KICKER_SCALING('CALLBACK',hObject,eventData,handles,...) calls the local
10%      function named CALLBACK in KICKER_SCALING.M with the given input arguments.
11%
12%      KICKER_SCALING('Property','Value',...) creates a new KICKER_SCALING or raises the
13%      existing singleton*.  Starting from the left, property value pairs are
14%      applied to the GUI before kicker_scaling_OpeningFunction gets called.  An
15%      unrecognized property name or invalid value makes property application
16%      stop.  All inputs are passed to kicker_scaling_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 kicker_scaling
24
25% Last Modified by GUIDE v2.5 14-Nov-2008 21:39:00
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', @kicker_scaling_OpeningFcn, ...
32                   'gui_OutputFcn',  @kicker_scaling_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 kicker_scaling is made visible.
48function kicker_scaling_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 kicker_scaling (see VARARGIN)
54
55% Choose default command line output for kicker_scaling
56handles.output = hObject;
57
58temp=tango_read_attribute2('ANS-C01/EP/AL_K.1', 'voltage');handles.K1=temp.value(2);
59temp=tango_read_attribute2('ANS-C01/EP/AL_K.2', 'voltage');handles.K2=temp.value(2);
60temp=tango_read_attribute2('ANS-C01/EP/AL_K.3', 'voltage');handles.K3=temp.value(2);
61temp=tango_read_attribute2('ANS-C01/EP/AL_K.4', 'voltage');handles.K4=temp.value(2);
62
63set(handles.edit_init_K1,'String',num2str(handles.K1));
64set(handles.edit_init_K2,'String',num2str(handles.K2));
65set(handles.edit_init_K3,'String',num2str(handles.K3));
66set(handles.edit_init_K4,'String',num2str(handles.K4));
67
68set(handles.edit_scaled_K1,'String',num2str(handles.K1));
69set(handles.edit_scaled_K2,'String',num2str(handles.K2));
70set(handles.edit_scaled_K3,'String',num2str(handles.K3));
71set(handles.edit_scaled_K4,'String',num2str(handles.K4));
72
73% Update handles structure
74guidata(hObject, handles);
75
76% UIWAIT makes kicker_scaling wait for user response (see UIRESUME)
77% uiwait(handles.figure1);
78
79
80% --- Outputs from this function are returned to the command line.
81function varargout = kicker_scaling_OutputFcn(hObject, eventdata, handles)
82% varargout  cell array for returning output args (see VARARGOUT);
83% hObject    handle to figure
84% eventdata  reserved - to be defined in a future version of MATLAB
85% handles    structure with handles and user data (see GUIDATA)
86
87% Get default command line output from handles structure
88varargout{1} = handles.output;
89
90
91% --- Executes on button press in pushbutton_restore.
92function pushbutton_restore_Callback(hObject, eventdata, handles)
93% hObject    handle to pushbutton_restore (see GCBO)
94% eventdata  reserved - to be defined in a future version of MATLAB
95% handles    structure with handles and user data (see GUIDATA)
96
97tango_write_attribute2('ANS-C01/EP/AL_K.1', 'voltage',handles.K1);
98tango_write_attribute2('ANS-C01/EP/AL_K.2', 'voltage',handles.K2);
99tango_write_attribute2('ANS-C01/EP/AL_K.3', 'voltage',handles.K3);
100tango_write_attribute2('ANS-C01/EP/AL_K.4', 'voltage',handles.K4);
101
102set(handles.edit_scaled_K1,'String',num2str(handles.K1));
103set(handles.edit_scaled_K2,'String',num2str(handles.K2));
104set(handles.edit_scaled_K3,'String',num2str(handles.K3));
105set(handles.edit_scaled_K4,'String',num2str(handles.K4));
106
107% --- Executes on button press in pushbutton_apply.
108function pushbutton_apply_Callback(hObject, eventdata, handles)
109% hObject    handle to pushbutton_apply (see GCBO)
110% eventdata  reserved - to be defined in a future version of MATLAB
111% handles    structure with handles and user data (see GUIDATA)
112
113r=str2double(get(handles.edit_scaling,'String'));
114if r>1.5
115    r=1 ;
116    set(handles.edit_scaling,'String','1');
117elseif r<0
118    r=1 ;
119    set(handles.edit_scaling,'String','1');
120end
121
122tango_write_attribute2('ANS-C01/EP/AL_K.1', 'voltage',handles.K1*r);
123tango_write_attribute2('ANS-C01/EP/AL_K.2', 'voltage',handles.K2*r);
124tango_write_attribute2('ANS-C01/EP/AL_K.3', 'voltage',handles.K3*r);
125tango_write_attribute2('ANS-C01/EP/AL_K.4', 'voltage',handles.K4*r);
126
127set(handles.edit_scaled_K1,'String',num2str(handles.K1*r));
128set(handles.edit_scaled_K2,'String',num2str(handles.K2*r));
129set(handles.edit_scaled_K3,'String',num2str(handles.K3*r));
130set(handles.edit_scaled_K4,'String',num2str(handles.K4*r));
131
132function edit_scaling_Callback(hObject, eventdata, handles)
133% hObject    handle to edit_scaling (see GCBO)
134% eventdata  reserved - to be defined in a future version of MATLAB
135% handles    structure with handles and user data (see GUIDATA)
136
137% Hints: get(hObject,'String') returns contents of edit_scaling as text
138%        str2double(get(hObject,'String')) returns contents of edit_scaling as a double
139
140
141% --- Executes during object creation, after setting all properties.
142function edit_scaling_CreateFcn(hObject, eventdata, handles)
143% hObject    handle to edit_scaling (see GCBO)
144% eventdata  reserved - to be defined in a future version of MATLAB
145% handles    empty - handles not created until after all CreateFcns called
146
147% Hint: edit controls usually have a white background on Windows.
148%       See ISPC and COMPUTER.
149if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
150    set(hObject,'BackgroundColor','white');
151end
152
153
154
155function edit_init_K1_Callback(hObject, eventdata, handles)
156% hObject    handle to edit_init_K1 (see GCBO)
157% eventdata  reserved - to be defined in a future version of MATLAB
158% handles    structure with handles and user data (see GUIDATA)
159
160% Hints: get(hObject,'String') returns contents of edit_init_K1 as text
161%        str2double(get(hObject,'String')) returns contents of edit_init_K1 as a double
162
163
164% --- Executes during object creation, after setting all properties.
165function edit_init_K1_CreateFcn(hObject, eventdata, handles)
166% hObject    handle to edit_init_K1 (see GCBO)
167% eventdata  reserved - to be defined in a future version of MATLAB
168% handles    empty - handles not created until after all CreateFcns called
169
170% Hint: edit controls usually have a white background on Windows.
171%       See ISPC and COMPUTER.
172if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
173    set(hObject,'BackgroundColor','white');
174end
175
176
177
178function edit_init_K2_Callback(hObject, eventdata, handles)
179% hObject    handle to edit_init_K2 (see GCBO)
180% eventdata  reserved - to be defined in a future version of MATLAB
181% handles    structure with handles and user data (see GUIDATA)
182
183% Hints: get(hObject,'String') returns contents of edit_init_K2 as text
184%        str2double(get(hObject,'String')) returns contents of edit_init_K2 as a double
185
186
187% --- Executes during object creation, after setting all properties.
188function edit_init_K2_CreateFcn(hObject, eventdata, handles)
189% hObject    handle to edit_init_K2 (see GCBO)
190% eventdata  reserved - to be defined in a future version of MATLAB
191% handles    empty - handles not created until after all CreateFcns called
192
193% Hint: edit controls usually have a white background on Windows.
194%       See ISPC and COMPUTER.
195if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
196    set(hObject,'BackgroundColor','white');
197end
198
199
200
201function edit_init_K3_Callback(hObject, eventdata, handles)
202% hObject    handle to edit_init_K3 (see GCBO)
203% eventdata  reserved - to be defined in a future version of MATLAB
204% handles    structure with handles and user data (see GUIDATA)
205
206% Hints: get(hObject,'String') returns contents of edit_init_K3 as text
207%        str2double(get(hObject,'String')) returns contents of edit_init_K3 as a double
208
209
210% --- Executes during object creation, after setting all properties.
211function edit_init_K3_CreateFcn(hObject, eventdata, handles)
212% hObject    handle to edit_init_K3 (see GCBO)
213% eventdata  reserved - to be defined in a future version of MATLAB
214% handles    empty - handles not created until after all CreateFcns called
215
216% Hint: edit controls usually have a white background on Windows.
217%       See ISPC and COMPUTER.
218if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
219    set(hObject,'BackgroundColor','white');
220end
221
222
223
224function edit_init_K4_Callback(hObject, eventdata, handles)
225% hObject    handle to edit_init_K4 (see GCBO)
226% eventdata  reserved - to be defined in a future version of MATLAB
227% handles    structure with handles and user data (see GUIDATA)
228
229% Hints: get(hObject,'String') returns contents of edit_init_K4 as text
230%        str2double(get(hObject,'String')) returns contents of edit_init_K4 as a double
231
232
233% --- Executes during object creation, after setting all properties.
234function edit_init_K4_CreateFcn(hObject, eventdata, handles)
235% hObject    handle to edit_init_K4 (see GCBO)
236% eventdata  reserved - to be defined in a future version of MATLAB
237% handles    empty - handles not created until after all CreateFcns called
238
239% Hint: edit controls usually have a white background on Windows.
240%       See ISPC and COMPUTER.
241if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
242    set(hObject,'BackgroundColor','white');
243end
244
245
246
247function edit_scaled_K1_Callback(hObject, eventdata, handles)
248% hObject    handle to edit_scaled_K1 (see GCBO)
249% eventdata  reserved - to be defined in a future version of MATLAB
250% handles    structure with handles and user data (see GUIDATA)
251
252% Hints: get(hObject,'String') returns contents of edit_scaled_K1 as text
253%        str2double(get(hObject,'String')) returns contents of edit_scaled_K1 as a double
254
255
256% --- Executes during object creation, after setting all properties.
257function edit_scaled_K1_CreateFcn(hObject, eventdata, handles)
258% hObject    handle to edit_scaled_K1 (see GCBO)
259% eventdata  reserved - to be defined in a future version of MATLAB
260% handles    empty - handles not created until after all CreateFcns called
261
262% Hint: edit controls usually have a white background on Windows.
263%       See ISPC and COMPUTER.
264if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
265    set(hObject,'BackgroundColor','white');
266end
267
268
269
270function edit_scaled_K2_Callback(hObject, eventdata, handles)
271% hObject    handle to edit_scaled_K2 (see GCBO)
272% eventdata  reserved - to be defined in a future version of MATLAB
273% handles    structure with handles and user data (see GUIDATA)
274
275% Hints: get(hObject,'String') returns contents of edit_scaled_K2 as text
276%        str2double(get(hObject,'String')) returns contents of edit_scaled_K2 as a double
277
278
279% --- Executes during object creation, after setting all properties.
280function edit_scaled_K2_CreateFcn(hObject, eventdata, handles)
281% hObject    handle to edit_scaled_K2 (see GCBO)
282% eventdata  reserved - to be defined in a future version of MATLAB
283% handles    empty - handles not created until after all CreateFcns called
284
285% Hint: edit controls usually have a white background on Windows.
286%       See ISPC and COMPUTER.
287if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
288    set(hObject,'BackgroundColor','white');
289end
290
291
292
293function edit_scaled_K3_Callback(hObject, eventdata, handles)
294% hObject    handle to edit_scaled_K3 (see GCBO)
295% eventdata  reserved - to be defined in a future version of MATLAB
296% handles    structure with handles and user data (see GUIDATA)
297
298% Hints: get(hObject,'String') returns contents of edit_scaled_K3 as text
299%        str2double(get(hObject,'String')) returns contents of edit_scaled_K3 as a double
300
301
302% --- Executes during object creation, after setting all properties.
303function edit_scaled_K3_CreateFcn(hObject, eventdata, handles)
304% hObject    handle to edit_scaled_K3 (see GCBO)
305% eventdata  reserved - to be defined in a future version of MATLAB
306% handles    empty - handles not created until after all CreateFcns called
307
308% Hint: edit controls usually have a white background on Windows.
309%       See ISPC and COMPUTER.
310if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
311    set(hObject,'BackgroundColor','white');
312end
313
314
315
316function edit_scaled_K4_Callback(hObject, eventdata, handles)
317% hObject    handle to edit_scaled_K4 (see GCBO)
318% eventdata  reserved - to be defined in a future version of MATLAB
319% handles    structure with handles and user data (see GUIDATA)
320
321% Hints: get(hObject,'String') returns contents of edit_scaled_K4 as text
322%        str2double(get(hObject,'String')) returns contents of edit_scaled_K4 as a double
323
324
325% --- Executes during object creation, after setting all properties.
326function edit_scaled_K4_CreateFcn(hObject, eventdata, handles)
327% hObject    handle to edit_scaled_K4 (see GCBO)
328% eventdata  reserved - to be defined in a future version of MATLAB
329% handles    empty - handles not created until after all CreateFcns called
330
331% Hint: edit controls usually have a white background on Windows.
332%       See ISPC and COMPUTER.
333if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
334    set(hObject,'BackgroundColor','white');
335end
336
337
Note: See TracBrowser for help on using the repository browser.