1 | function 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 |
---|
28 | gui_Singleton = 1; |
---|
29 | gui_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', []); |
---|
35 | if nargin && ischar(varargin{1}) |
---|
36 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
37 | end |
---|
38 | |
---|
39 | if nargout |
---|
40 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
41 | else |
---|
42 | gui_mainfcn(gui_State, varargin{:}); |
---|
43 | end |
---|
44 | % End initialization code - DO NOT EDIT |
---|
45 | |
---|
46 | |
---|
47 | % --- Executes just before kicker_scaling is made visible. |
---|
48 | function 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 |
---|
56 | handles.output = hObject; |
---|
57 | |
---|
58 | temp=tango_read_attribute2('ANS-C01/EP/AL_K.1', 'voltage');handles.K1=temp.value(2); |
---|
59 | temp=tango_read_attribute2('ANS-C01/EP/AL_K.2', 'voltage');handles.K2=temp.value(2); |
---|
60 | temp=tango_read_attribute2('ANS-C01/EP/AL_K.3', 'voltage');handles.K3=temp.value(2); |
---|
61 | temp=tango_read_attribute2('ANS-C01/EP/AL_K.4', 'voltage');handles.K4=temp.value(2); |
---|
62 | |
---|
63 | set(handles.edit_init_K1,'String',num2str(handles.K1)); |
---|
64 | set(handles.edit_init_K2,'String',num2str(handles.K2)); |
---|
65 | set(handles.edit_init_K3,'String',num2str(handles.K3)); |
---|
66 | set(handles.edit_init_K4,'String',num2str(handles.K4)); |
---|
67 | |
---|
68 | set(handles.edit_scaled_K1,'String',num2str(handles.K1)); |
---|
69 | set(handles.edit_scaled_K2,'String',num2str(handles.K2)); |
---|
70 | set(handles.edit_scaled_K3,'String',num2str(handles.K3)); |
---|
71 | set(handles.edit_scaled_K4,'String',num2str(handles.K4)); |
---|
72 | |
---|
73 | % Update handles structure |
---|
74 | guidata(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. |
---|
81 | function 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 |
---|
88 | varargout{1} = handles.output; |
---|
89 | |
---|
90 | |
---|
91 | % --- Executes on button press in pushbutton_restore. |
---|
92 | function 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 | |
---|
97 | tango_write_attribute2('ANS-C01/EP/AL_K.1', 'voltage',handles.K1); |
---|
98 | tango_write_attribute2('ANS-C01/EP/AL_K.2', 'voltage',handles.K2); |
---|
99 | tango_write_attribute2('ANS-C01/EP/AL_K.3', 'voltage',handles.K3); |
---|
100 | tango_write_attribute2('ANS-C01/EP/AL_K.4', 'voltage',handles.K4); |
---|
101 | |
---|
102 | set(handles.edit_scaled_K1,'String',num2str(handles.K1)); |
---|
103 | set(handles.edit_scaled_K2,'String',num2str(handles.K2)); |
---|
104 | set(handles.edit_scaled_K3,'String',num2str(handles.K3)); |
---|
105 | set(handles.edit_scaled_K4,'String',num2str(handles.K4)); |
---|
106 | |
---|
107 | % --- Executes on button press in pushbutton_apply. |
---|
108 | function 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 | |
---|
113 | r=str2double(get(handles.edit_scaling,'String')); |
---|
114 | if r>1.5 |
---|
115 | r=1 ; |
---|
116 | set(handles.edit_scaling,'String','1'); |
---|
117 | elseif r<0 |
---|
118 | r=1 ; |
---|
119 | set(handles.edit_scaling,'String','1'); |
---|
120 | end |
---|
121 | |
---|
122 | tango_write_attribute2('ANS-C01/EP/AL_K.1', 'voltage',handles.K1*r); |
---|
123 | tango_write_attribute2('ANS-C01/EP/AL_K.2', 'voltage',handles.K2*r); |
---|
124 | tango_write_attribute2('ANS-C01/EP/AL_K.3', 'voltage',handles.K3*r); |
---|
125 | tango_write_attribute2('ANS-C01/EP/AL_K.4', 'voltage',handles.K4*r); |
---|
126 | |
---|
127 | set(handles.edit_scaled_K1,'String',num2str(handles.K1*r)); |
---|
128 | set(handles.edit_scaled_K2,'String',num2str(handles.K2*r)); |
---|
129 | set(handles.edit_scaled_K3,'String',num2str(handles.K3*r)); |
---|
130 | set(handles.edit_scaled_K4,'String',num2str(handles.K4*r)); |
---|
131 | |
---|
132 | function 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. |
---|
142 | function 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. |
---|
149 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
150 | set(hObject,'BackgroundColor','white'); |
---|
151 | end |
---|
152 | |
---|
153 | |
---|
154 | |
---|
155 | function 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. |
---|
165 | function 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. |
---|
172 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
173 | set(hObject,'BackgroundColor','white'); |
---|
174 | end |
---|
175 | |
---|
176 | |
---|
177 | |
---|
178 | function 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. |
---|
188 | function 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. |
---|
195 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
196 | set(hObject,'BackgroundColor','white'); |
---|
197 | end |
---|
198 | |
---|
199 | |
---|
200 | |
---|
201 | function 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. |
---|
211 | function 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. |
---|
218 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
219 | set(hObject,'BackgroundColor','white'); |
---|
220 | end |
---|
221 | |
---|
222 | |
---|
223 | |
---|
224 | function 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. |
---|
234 | function 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. |
---|
241 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
242 | set(hObject,'BackgroundColor','white'); |
---|
243 | end |
---|
244 | |
---|
245 | |
---|
246 | |
---|
247 | function 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. |
---|
257 | function 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. |
---|
264 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
265 | set(hObject,'BackgroundColor','white'); |
---|
266 | end |
---|
267 | |
---|
268 | |
---|
269 | |
---|
270 | function 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. |
---|
280 | function 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. |
---|
287 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
288 | set(hObject,'BackgroundColor','white'); |
---|
289 | end |
---|
290 | |
---|
291 | |
---|
292 | |
---|
293 | function 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. |
---|
303 | function 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. |
---|
310 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
311 | set(hObject,'BackgroundColor','white'); |
---|
312 | end |
---|
313 | |
---|
314 | |
---|
315 | |
---|
316 | function 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. |
---|
326 | function 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. |
---|
333 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
334 | set(hObject,'BackgroundColor','white'); |
---|
335 | end |
---|
336 | |
---|
337 | |
---|