1 | function varargout = ACenergie1(varargin) |
---|
2 | % ACENERGIE1 M-file for ACenergie1.fig |
---|
3 | % ACENERGIE1, by itself, creates a new ACENERGIE1 or raises the existing |
---|
4 | % singleton*. |
---|
5 | % |
---|
6 | % H = ACENERGIE1 returns the handle to a new ACENERGIE1 or the handle to |
---|
7 | % the existing singleton*. |
---|
8 | % |
---|
9 | % ACENERGIE1('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
10 | % function named CALLBACK in ACENERGIE1.M with the given input arguments. |
---|
11 | % |
---|
12 | % ACENERGIE1('Property','Value',...) creates a new ACENERGIE1 or raises the |
---|
13 | % existing singleton*. Starting from the left, property value pairs are |
---|
14 | % applied to the GUI before ACenergie1_OpeningFunction gets called. An |
---|
15 | % unrecognized property name or invalid value makes property application |
---|
16 | % stop. All inputs are passed to ACenergie1_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 ACenergie1 |
---|
24 | |
---|
25 | % Last Modified by GUIDE v2.5 05-May-2006 10:10:07 |
---|
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', @ACenergie1_OpeningFcn, ... |
---|
32 | 'gui_OutputFcn', @ACenergie1_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 ACenergie1 is made visible. |
---|
48 | function ACenergie1_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 ACenergie1 (see VARARGIN) |
---|
54 | |
---|
55 | % Choose default command line output for ACenergie1 |
---|
56 | handles.output = hObject; |
---|
57 | |
---|
58 | % Update handles structure/home/operateur |
---|
59 | guidata(hObject, handles); |
---|
60 | |
---|
61 | % UIWAIT makes ACenergie1 wait for user response (see UIRESUME) |
---|
62 | % uiwait(handles.figure1); |
---|
63 | |
---|
64 | |
---|
65 | % --- Outputs from this function are returned to the command line. |
---|
66 | function varargout = ACenergie1_OutputFcn(hObject, eventdata, handles) |
---|
67 | % varargout cell array for returning output args (see VARARGOUT); |
---|
68 | % hObject handle to figure |
---|
69 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
70 | % handles structure with handles and user data (see GUIDATA) |
---|
71 | |
---|
72 | % Get default command line output from handles structure |
---|
73 | varargout{1} = handles.output; |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | function edit_energie_Callback(hObject, eventdata, handles) |
---|
78 | % hObject handle to edit_energie (see GCBO) |
---|
79 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
80 | % handles structure with handles and user data (see GUIDATA) |
---|
81 | |
---|
82 | % Hints: get(hObject,'String') returns contents of edit_energie as text |
---|
83 | % str2double(get(hObject,'String')) returns contents of edit_energie as a double |
---|
84 | |
---|
85 | |
---|
86 | % --- Executes during object creation, after setting all properties. |
---|
87 | function edit_energie_CreateFcn(hObject, eventdata, handles) |
---|
88 | % hObject handle to edit_energie (see GCBO) |
---|
89 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
90 | % handles empty - handles not created until after all CreateFcns called |
---|
91 | |
---|
92 | % Hint: edit controls usually have a white background on Windows. |
---|
93 | % See ISPC and COMPUTER. |
---|
94 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
95 | set(hObject,'BackgroundColor','white'); |
---|
96 | end |
---|
97 | |
---|
98 | |
---|
99 | % --- Executes on button press in button_apply. |
---|
100 | function button_apply_Callback(hObject, eventdata, handles) |
---|
101 | % hObject handle to button_apply (see GCBO) |
---|
102 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
103 | % handles structure with handles and user data (see GUIDATA) |
---|
104 | |
---|
105 | r=str2double(get(handles.edit_energie,'String')); |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | val(1)=readattribute('BOO/AE/D.1/current' ,'Setpoint'); |
---|
110 | val(2)=readattribute('BOO/AE/QF/current' ,'Setpoint'); |
---|
111 | val(3)=readattribute('BOO/AE/QD/current' ,'Setpoint'); |
---|
112 | |
---|
113 | val(4)=readattribute('BOO-C10/EP/AL_DOF.1/voltagePeakValue'); |
---|
114 | val(5)=readattribute('BOO-C11/EP/AL_DOF.2/voltagePeakValue'); |
---|
115 | val(6)=readattribute('BOO-C12/EP/AL_DOF.3/voltagePeakValue'); |
---|
116 | |
---|
117 | val(7)=readattribute('BOO-C10/EP/AL_K.Ext/voltage'); |
---|
118 | val(8)=readattribute('BOO-C11/EP/AL_SEP_P.Ext.1/serialVoltage'); |
---|
119 | val(9)=readattribute('BOO-C12/EP/AL_SEP_A.Ext/voltage'); |
---|
120 | |
---|
121 | temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay'); |
---|
122 | Tinj=temp.value(1); |
---|
123 | temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay'); |
---|
124 | Tsoft=temp.value(1); |
---|
125 | |
---|
126 | |
---|
127 | val=val*(1+r/100) |
---|
128 | Tinj =Tinj - r*100 ; % 1% = + 100 µs |
---|
129 | Tsoft=Tsoft- r*100 ; % 1% = + 100 µs |
---|
130 | |
---|
131 | |
---|
132 | if (val(1) >= 22) |
---|
133 | |
---|
134 | set(handles.edit_dipole,'String',' Too big !'); |
---|
135 | set(handles.edit_qf,'String',' not'); |
---|
136 | set(handles.edit_qd,'String',' applied !'); |
---|
137 | set(handles.edit_energie,'String',num2str(0)); |
---|
138 | |
---|
139 | else |
---|
140 | |
---|
141 | val |
---|
142 | Tinj |
---|
143 | set(handles.edit_dipole,'String',num2str(val(1))); |
---|
144 | set(handles.edit_qf,'String',num2str(val(2))); |
---|
145 | set(handles.edit_qd,'String',num2str(val(3))); |
---|
146 | |
---|
147 | % writeattribute('BOO/AE/D.1/current' ,val(1)); |
---|
148 | % writeattribute('BOO/AE/QF/current' ,val(2)); |
---|
149 | % writeattribute('BOO/AE/QD/current' ,val(3)); |
---|
150 | |
---|
151 | % writeattribute('BOO-C10/EP/AL_DOF.1/voltagePeakValue',val(4)); |
---|
152 | % writeattribute('BOO-C11/EP/AL_DOF.2/voltagePeakValue',val(5)); |
---|
153 | % writeattribute('BOO-C12/EP/AL_DOF.3/voltagePeakValue',val(6)); |
---|
154 | % writeattribute('BOO-C10/EP/AL_K.Ext/voltage',val(7)); |
---|
155 | % writeattribute('BOO-C11/EP/AL_SEP_P.Ext.1/serialVoltage',val(8)); |
---|
156 | % writeattribute('BOO-C12/EP/AL_SEP_A.Ext/voltage,',val(9)); |
---|
157 | % tango_write_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay',Tinj); |
---|
158 | % tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay',Tsoft); |
---|
159 | |
---|
160 | end |
---|
161 | |
---|
162 | |
---|
163 | function edit_dipole_Callback(hObject, eventdata, handles) |
---|
164 | % hObject handle to edit_dipole (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 | % Hints: get(hObject,'String') returns contents of edit_dipole as text |
---|
169 | % str2double(get(hObject,'String')) returns contents of edit_dipole as a double |
---|
170 | |
---|
171 | |
---|
172 | % --- Executes during object creation, after setting all properties. |
---|
173 | function edit_dipole_CreateFcn(hObject, eventdata, handles) |
---|
174 | % hObject handle to edit_dipole (see GCBO) |
---|
175 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
176 | % handles empty - handles not created until after all CreateFcns called |
---|
177 | |
---|
178 | % Hint: edit controls usually have a white background on Windows. |
---|
179 | % See ISPC and COMPUTER. |
---|
180 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
181 | set(hObject,'BackgroundColor','white'); |
---|
182 | end |
---|
183 | |
---|
184 | |
---|
185 | |
---|
186 | function edit_qf_Callback(hObject, eventdata, handles) |
---|
187 | % hObject handle to edit_qf (see GCBO) |
---|
188 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
189 | % handles structure with handles and user data (see GUIDATA) |
---|
190 | |
---|
191 | % Hints: get(hObject,'String') returns contents of edit_qf as text |
---|
192 | % str2double(get(hObject,'String')) returns contents of edit_qf as a double |
---|
193 | |
---|
194 | |
---|
195 | % --- Executes during object creation, after setting all properties. |
---|
196 | function edit_qf_CreateFcn(hObject, eventdata, handles) |
---|
197 | % hObject handle to edit_qf (see GCBO) |
---|
198 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
199 | % handles empty - handles not created until after all CreateFcns called |
---|
200 | |
---|
201 | % Hint: edit controls usually have a white background on Windows. |
---|
202 | % See ISPC and COMPUTER. |
---|
203 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
204 | set(hObject,'BackgroundColor','white'); |
---|
205 | end |
---|
206 | |
---|
207 | |
---|
208 | |
---|
209 | function edit_qd_Callback(hObject, eventdata, handles) |
---|
210 | % hObject handle to edit_qd (see GCBO) |
---|
211 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
212 | % handles structure with handles and user data (see GUIDATA) |
---|
213 | |
---|
214 | % Hints: get(hObject,'String') returns contents of edit_qd as text |
---|
215 | % str2double(get(hObject,'String')) returns contents of edit_qd as a double |
---|
216 | |
---|
217 | |
---|
218 | % --- Executes during object creation, after setting all properties. |
---|
219 | function edit_qd_CreateFcn(hObject, eventdata, handles) |
---|
220 | % hObject handle to edit_qd (see GCBO) |
---|
221 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
222 | % handles empty - handles not created until after all CreateFcns called |
---|
223 | |
---|
224 | % Hint: edit controls usually have a white background on Windows. |
---|
225 | % See ISPC and COMPUTER. |
---|
226 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
227 | set(hObject,'BackgroundColor','white'); |
---|
228 | end |
---|
229 | |
---|
230 | |
---|