1 | function varargout = LOCOsymgui(varargin) |
---|
2 | % LOCOSYMGUI M-file for LOCOsymgui.fig |
---|
3 | % LOCOSYMGUI, by itself, creates a new LOCOSYMGUI or raises the existing |
---|
4 | % singleton*. |
---|
5 | % |
---|
6 | % H = LOCOSYMGUI returns the handle to a new LOCOSYMGUI or the handle to |
---|
7 | % the existing singleton*. |
---|
8 | % |
---|
9 | % LOCOSYMGUI('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
10 | % function named CALLBACK in LOCOSYMGUI.M with the given input arguments. |
---|
11 | % |
---|
12 | % LOCOSYMGUI('Property','Value',...) creates a new LOCOSYMGUI or raises the |
---|
13 | % existing singleton*. Starting from the left, property value pairs are |
---|
14 | % applied to the GUI before LOCOsymgui_OpeningFunction gets called. An |
---|
15 | % unrecognized property name or invalid value makes property application |
---|
16 | % stop. All inputs are passed to LOCOsymgui_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 LOCOsymgui |
---|
24 | |
---|
25 | % Last Modified by GUIDE v2.5 21-Jul-2009 20:40:07 |
---|
26 | |
---|
27 | % Begin initialization code - DO NOT EDIT |
---|
28 | |
---|
29 | fprintf('Appli HS en optique 163 quadrupoles\n') |
---|
30 | return; |
---|
31 | |
---|
32 | gui_Singleton = 1; |
---|
33 | gui_State = struct('gui_Name', mfilename, ... |
---|
34 | 'gui_Singleton', gui_Singleton, ... |
---|
35 | 'gui_OpeningFcn', @LOCOsymgui_OpeningFcn, ... |
---|
36 | 'gui_OutputFcn', @LOCOsymgui_OutputFcn, ... |
---|
37 | 'gui_LayoutFcn', [] , ... |
---|
38 | 'gui_Callback', []); |
---|
39 | if nargin && ischar(varargin{1}) |
---|
40 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
41 | end |
---|
42 | |
---|
43 | if nargout |
---|
44 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
45 | else |
---|
46 | gui_mainfcn(gui_State, varargin{:}); |
---|
47 | end |
---|
48 | % End initialization code - DO NOT EDIT |
---|
49 | |
---|
50 | |
---|
51 | % --- Executes just before LOCOsymgui is made visible. |
---|
52 | function LOCOsymgui_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
53 | % This function has no output args, see OutputFcn. |
---|
54 | % hObject handle to figure |
---|
55 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
56 | % handles structure with handles and user data (see GUIDATA) |
---|
57 | % varargin command line arguments to LOCOsymgui (see VARARGIN) |
---|
58 | |
---|
59 | % Choose default command line output for LOCOsymgui |
---|
60 | handles.output = hObject; |
---|
61 | |
---|
62 | % Update handles structure |
---|
63 | guidata(hObject, handles); |
---|
64 | |
---|
65 | % UIWAIT makes LOCOsymgui wait for user response (see UIRESUME) |
---|
66 | % uiwait(handles.figure1); |
---|
67 | |
---|
68 | handles.DK = NaN; |
---|
69 | handles.Mode = 'Online'; |
---|
70 | |
---|
71 | handles.K1i_before = NaN; |
---|
72 | handles.K2i_before = NaN; |
---|
73 | handles.K3i_before = NaN; |
---|
74 | handles.K4i_before = NaN; |
---|
75 | handles.K5i_before = NaN; |
---|
76 | handles.K6i_before = NaN; |
---|
77 | handles.K7i_before = NaN; |
---|
78 | handles.K8i_before = NaN; |
---|
79 | handles.K9i_before = NaN; |
---|
80 | handles.K10i_before = NaN; |
---|
81 | handles.QT_before = NaN; |
---|
82 | handles.tune_before = NaN; |
---|
83 | |
---|
84 | % Update handles structure |
---|
85 | guidata(hObject, handles); |
---|
86 | |
---|
87 | % --- Outputs from this function are returned to the command line. |
---|
88 | function varargout = LOCOsymgui_OutputFcn(hObject, eventdata, handles) |
---|
89 | % varargout cell array for returning output args (see VARARGOUT); |
---|
90 | % hObject handle to figure |
---|
91 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
92 | % handles structure with handles and user data (see GUIDATA) |
---|
93 | |
---|
94 | % Get default command line output from handles structure |
---|
95 | varargout{1} = handles.output; |
---|
96 | |
---|
97 | % --- Executes on button press in pushbutton_storedata. |
---|
98 | function pushbutton_storedata_Callback(hObject, eventdata, handles) |
---|
99 | % hObject handle to pushbutton_storedata (see GCBO) |
---|
100 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
101 | % handles structure with handles and user data (see GUIDATA) |
---|
102 | |
---|
103 | |
---|
104 | Mode = 'Online'; |
---|
105 | |
---|
106 | fprintf('Reading Quad values \n'); |
---|
107 | |
---|
108 | try |
---|
109 | handles.K1i_before=getsp('Q1',handles.Mode,'Physics'); |
---|
110 | handles.K2i_before=getsp('Q2',handles.Mode,'Physics'); |
---|
111 | handles.K3i_before=getsp('Q3',handles.Mode,'Physics'); |
---|
112 | handles.K4i_before=getsp('Q4',handles.Mode,'Physics'); |
---|
113 | handles.K5i_before=getsp('Q5',handles.Mode,'Physics'); |
---|
114 | handles.K6i_before=getsp('Q6',handles.Mode,'Physics'); |
---|
115 | handles.K7i_before=getsp('Q7',handles.Mode,'Physics'); |
---|
116 | handles.K8i_before=getsp('Q8',handles.Mode,'Physics'); |
---|
117 | handles.K9i_before=getsp('Q9',handles.Mode,'Physics'); |
---|
118 | handles.K10i_before=getsp('Q10',handles.Mode,'Physics'); |
---|
119 | |
---|
120 | handles.QT_before = getsp('QT', handles.Mode, 'Physics'); |
---|
121 | |
---|
122 | handles.tune_before = gettune; |
---|
123 | |
---|
124 | fprintf('Nux = %f Nuz = %f\n', handles.tune_before); |
---|
125 | |
---|
126 | set(handles.pushbutton_Symmetry,'Enable', 'On') |
---|
127 | set(handles.pushbutton_Coupling,'Enable', 'On') |
---|
128 | |
---|
129 | catch |
---|
130 | fprintf('Error \n') |
---|
131 | end |
---|
132 | |
---|
133 | % Update handles structure |
---|
134 | guidata(hObject, handles); |
---|
135 | |
---|
136 | |
---|
137 | % --- Executes on button press in pushbutton_Symmetry. |
---|
138 | function pushbutton_Symmetry_Callback(hObject, eventdata, handles) |
---|
139 | % hObject handle to pushbutton_Symmetry (see GCBO) |
---|
140 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
141 | % handles structure with handles and user data (see GUIDATA) |
---|
142 | |
---|
143 | |
---|
144 | %% 160 quad % -1 full correctionvehandles.DK |
---|
145 | k = -1; |
---|
146 | setsp('Q1',k* handles.DK(1:8) + handles.K1i_before, handles.Mode,'Physics'); |
---|
147 | setsp('Q2',k* handles.DK(9:16) + handles.K2i_before, handles.Mode,'Physics'); |
---|
148 | setsp('Q3',k* handles.DK(17:24) + handles.K3i_before, handles.Mode,'Physics'); |
---|
149 | setsp('Q4',k* handles.DK(25:40) + handles.K4i_before, handles.Mode,'Physics'); |
---|
150 | setsp('Q5',k* handles.DK(41:56) + handles.K5i_before, handles.Mode,'Physics'); |
---|
151 | setsp('Q6',k* handles.DK(57:80) + handles.K6i_before, handles.Mode,'Physics'); |
---|
152 | setsp('Q7',k* handles.DK(81:104) + handles.K7i_before, handles.Mode,'Physics'); |
---|
153 | setsp('Q8',k* handles.DK(105:128) + handles.K8i_before, handles.Mode,'Physics'); |
---|
154 | setsp('Q9',k* handles.DK(129:144) + handles.K9i_before, handles.Mode,'Physics'); |
---|
155 | setsp('Q10',k* handles.DK(145:160) + handles.K10i_before, handles.Mode,'Physics'); |
---|
156 | pause(5); |
---|
157 | tune = gettune; |
---|
158 | fprintf('Tunes variations for iter0 is Dnux = %f Dnuz =%f\n', tune-handles.tune_before); |
---|
159 | |
---|
160 | set(handles.pushbutton_CancelDK, 'Enable', 'on'); |
---|
161 | |
---|
162 | % --- Executes on button press in pushbutton_Coupling. |
---|
163 | function pushbutton_Coupling_Callback(hObject, eventdata, handles) |
---|
164 | % hObject handle to pushbutton_Coupling (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 | %% skew quad -1 for full correction |
---|
169 | k =-1; |
---|
170 | setsp('QT',k* handles.DK(161:192) + handles.QT_before, handles.Mode,'Physics'); |
---|
171 | |
---|
172 | fprintf('Correction applied on QTs \n'); |
---|
173 | |
---|
174 | set(handles.pushbutton_CancelDK, 'Enable', 'on'); |
---|
175 | |
---|
176 | % --- Executes on button press in pushbutton_LOCODATA. |
---|
177 | function pushbutton_LOCODATA_Callback(hObject, eventdata, handles) |
---|
178 | % hObject handle to pushbutton_LOCODATA (see GCBO) |
---|
179 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
180 | % handles structure with handles and user data (see GUIDATA) |
---|
181 | |
---|
182 | temp = evalin('base', 'LOCOstruct'); |
---|
183 | |
---|
184 | handles.DK = temp.DK; |
---|
185 | |
---|
186 | % Update handles structure |
---|
187 | guidata(hObject, handles); |
---|
188 | |
---|
189 | set(handles.pushbutton_LOCODATA, 'BackgroundColor', [0 1 0]); |
---|
190 | set(handles.pushbutton_PlotDK, 'Enable', 'on'); |
---|
191 | |
---|
192 | |
---|
193 | |
---|
194 | % --- Executes on button press in pushbutton_PlotDK. |
---|
195 | function pushbutton_PlotDK_Callback(hObject, eventdata, handles) |
---|
196 | % hObject handle to pushbutton_PlotDK (see GCBO) |
---|
197 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
198 | % handles structure with handles and user data (see GUIDATA) |
---|
199 | |
---|
200 | analoco('160quad'); |
---|
201 | |
---|
202 | |
---|
203 | % --- Executes on button press in pushbutton_CancelDK. |
---|
204 | function pushbutton_CancelDK_Callback(hObject, eventdata, handles) |
---|
205 | % hObject handle to pushbutton_CancelDK (see GCBO) |
---|
206 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
207 | % handles structure with handles and user data (see GUIDATA) |
---|
208 | |
---|
209 | %% 160 quad % -1 full correctionvehandles.DK |
---|
210 | k = 0; |
---|
211 | QuadFlag = 0; |
---|
212 | QTFlag = 1; |
---|
213 | |
---|
214 | if QuadFlag |
---|
215 | setsp('Q1',k* handles.DK(1:8) + handles.K1i_before, handles.Mode,'Physics'); |
---|
216 | setsp('Q2',k* handles.DK(9:16) + handles.K2i_before, handles.Mode,'Physics'); |
---|
217 | setsp('Q3',k* handles.DK(17:24) + handles.K3i_before, handles.Mode,'Physics'); |
---|
218 | setsp('Q4',k* handles.DK(25:40) + handles.K4i_before, handles.Mode,'Physics'); |
---|
219 | setsp('Q5',k* handles.DK(41:56) + handles.K5i_before, handles.Mode,'Physics'); |
---|
220 | setsp('Q6',k* handles.DK(57:80) + handles.K6i_before, handles.Mode,'Physics'); |
---|
221 | setsp('Q7',k* handles.DK(81:104) + handles.K7i_before, handles.Mode,'Physics'); |
---|
222 | setsp('Q8',k* handles.DK(105:128) + handles.K8i_before, handles.Mode,'Physics'); |
---|
223 | setsp('Q9',k* handles.DK(129:144) + handles.K9i_before, handles.Mode,'Physics'); |
---|
224 | setsp('Q10',k* handles.DK(145:160) + handles.K10i_before, handles.Mode,'Physics'); |
---|
225 | end |
---|
226 | |
---|
227 | if QTFlag |
---|
228 | setsp('QT',k* handles.DK(161:192) + handles.QT_before, handles.Mode,'Physics'); |
---|
229 | end |
---|
230 | |
---|
231 | pause(5); |
---|
232 | tune = gettune; |
---|
233 | fprintf('Tunes variations for iter0 is Dnux = %f Dnuz =%f\n', tune-handles.tune_before); |
---|
234 | |
---|
235 | set(handles.pushbutton_CancelDK, 'Enable', 'off'); |
---|
236 | |
---|
237 | |
---|
238 | % --- Executes on button press in checkbox_Quad. |
---|
239 | function checkbox_Quad_Callback(hObject, eventdata, handles) |
---|
240 | % hObject handle to checkbox_Quad (see GCBO) |
---|
241 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
242 | % handles structure with handles and user data (see GUIDATA) |
---|
243 | |
---|
244 | % Hint: get(hObject,'Value') returns toggle state of checkbox_Quad |
---|
245 | |
---|
246 | |
---|
247 | % --- Executes on button press in checkbox_QT. |
---|
248 | function checkbox_QT_Callback(hObject, eventdata, handles) |
---|
249 | % hObject handle to checkbox_QT (see GCBO) |
---|
250 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
251 | % handles structure with handles and user data (see GUIDATA) |
---|
252 | |
---|
253 | % Hint: get(hObject,'Value') returns toggle state of checkbox_QT |
---|
254 | |
---|
255 | |
---|