source: MML/trunk/machine/SOLEIL/common/database/learn_tangodb.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: 8.4 KB
Line 
1%
2return;
3dbserver = 'sys/database/2';
4res = tango_command_list_query(dbserver)
5
6DbAddDevice
7DbAddServer
8DbDeleteAttributeAlias
9DbDeleteClassAttribute
10DbDeleteClassAttributeProperty
11DbDeleteClassProperty
12DbDeleteDevice
13DbDeleteDeviceAlias
14DbDeleteDeviceAttribute
15DbDeleteDeviceAttributeProperty
16DbDeleteDeviceProperty
17DbDeleteProperty
18DbDeleteServer
19DbDeleteServerInfo
20DbExportDevice
21DbExportEvent
22DbGetAliasDevice
23DbGetAttributeAlias
24DbGetAttributeAliasList
25DbGetClassAttributeList
26DbGetClassAttributeProperty
27DbGetClassList
28DbGetClassProperty
29DbGetClassPropertyList
30DbGetDeviceAliasList
31DbGetDeviceAttributeList
32DbGetDeviceAttributeProperty
33DbGetDeviceClassList
34DbGetDeviceDomainList
35DbGetDeviceExportedList
36DbGetDeviceFamilyList
37DbGetDeviceList
38DbGetDeviceMemberList
39DbGetDeviceProperty
40DbGetDevicePropertyList
41DbGetDeviceServerClassList
42DbGetHostList
43DbGetHostServerList
44DbGetHostServersInfo
45DbGetInstanceNameList
46DbGetObjectList
47DbGetProperty
48DbGetPropertyList
49DbGetServerInfo
50DbGetServerList
51DbGetServerNameList
52DbImportDevice
53DbImportEvent
54DbInfo
55DbPutAttributeAlias
56DbPutClassAttributeProperty
57DbPutClassProperty
58DbPutDeviceAlias
59DbPutDeviceAttributeProperty
60DbPutDeviceProperty
61DbPutProperty
62DbPutServerInfo
63DbUnExportDevice
64DbUnExportEvent
65DbUnExportServer
66Init
67State
68Status
69
70res = tango_command_inout(dbserver,'DbGetDeviceFamilyList','*')
71res = tango_command_inout(dbserver,'DbInfo')
72res = tango_command_inout(dbserver,'Status')
73
74%% Ajout d'un device
75% Argument minimum: serveur device Class
76
77tango_command_inout(dbserver,'DbAddDevice',{'ds_bpm/bpm1','ANS/DGsim/BPM000','Bpm'})
78
79for k=1:5
80    Device = strcat('ANS/DGsim/BPM00',num2str(k))
81    tango_command_inout(dbserver,'DbAddDevice',{'ds_bpm/bpm1',Device,'Bpm'})
82end
83
84%% Effacer une device de la Database statique
85for k=1:5
86    Device = strcat('ANS/DGsim/BPM00',num2str(k))
87    tango_command_inout(dbserver,'DbDeleteDevice',Device)
88end
89
90% Ajouter un device serveur et les devices associes
91className='TangoParser';
92deviceName='LT1/VI/COMP.3';
93serverName='tangoparser/LT1';
94
95argin = {serverName,deviceName,className};
96tango_command_inout(dbserver,'DbAddDevice',argin)
97
98% efface
99%tango_command_inout(dbserver,'DbDeleteDevice',deviceName)
100
101% Lire une propriete d'un device
102tango_command_inout2(dbserver,'DbGetDeviceProperty',{deviceName, propertyName});
103
104% cree une propriete de device
105% valeur somme pour les pressions
106propertyName = 'AttributeNames';
107tangoNames= family2tango('PI');
108%%
109nb = length(tangoNames);
110
111% build list of the type
112% x1, attribute1
113% x2, attribute2
114% ...
115% xn, attributen
116
117for k = 1:nb,
118    mapping{k} = ['x', num2str(k) ',' tangoNames{k}]
119end
120
121argin = {deviceName, '1', propertyName, num2str(nb), mapping{:}};
122tango_command_inout2(dbserver,'DbPutDeviceProperty',argin);
123
124propertyName = 'OutputNames';
125tango_command_inout2(dbserver,'DbPutDeviceProperty',{deviceName, '1', propertyName, '1', 'diff '});
126
127%% 2 commands required
128% init
129%tango_command_inout2(deviceName,'Init');
130
131% set expression
132stringExpression = [];
133for k=1:nb,
134    if k ~= nb && k ~= 1
135        stringExpression = [stringExpression 'x' num2str(k) '+'];
136    elseif k == 1
137        stringExpression = ['(' stringExpression 'x' num2str(k) '+'];
138    elseif k == nb
139        stringExpression = [stringExpression 'x' num2str(k) ') + 54/' num2str(nb)];
140    end
141end
142
143tango_command_inout2(deviceName,'SetExpression',{'sum', stringExpression});
144
145% tango_command_inout2(deviceName,'GetExpression','meanPressure');
146
147% unexport un device
148%tango_command_inout2(dbserver,'DbUnExportDevice','tango/tangoparser/1')
149
150%% Nomenclature vide LT2
151
152%% vide
153
154liste = {
155'LT2/VI/PI40.1',
156'LT2/VI/PI55.2',
157'LT2/VI/PI55.3',
158'LT2/VI/PI55.4',
159'LT2/VI/PI55.5',
160'LT2/VI/PI55.6',
161'LT2/VI/PI150.7',
162'LT2/VI/PI55.8',
163'LT2/VI/PI55.9',
164'LT2/VI/PI55.10',
165'LT2/VI/PI55.11',
166'LT2/VI/PI55.12',
167'LT2/VI/PI55.13',
168'LT2/VI/PI55.14',
169'LT2/VI/PI40.15'
170}
171
172serverName = 'ionpump/PI4LT2';
173className = 'IonPump';
174for k=1:length(liste),
175    deviceName = liste{k};
176    tango_command_inout2(dbserver,'DbAddDevice',{serverName,deviceName,className})
177%     tango_command_inout(dbserver,'DbDeleteDevice',deviceName);
178end
179
180serverName = 'penninggauge/JPEN4LT2';
181className = 'PenningGauge';
182for k=1:3,
183    deviceName = ['LT2/VI/JPEN.' num2str(k)];
184     tango_command_inout2(dbserver,'DbAddDevice',{serverName,deviceName,className})
185%     tango_command_inout(dbserver,'DbDeleteDevice',deviceName);
186end
187
188
189serverName = 'piranigauge/JPIR4LT2';
190className = 'PiraniGauge';
191
192for k=1:3,
193    deviceName = ['LT2/VI/JPIR.' num2str(k)];
194     tango_command_inout2(dbserver,'DbAddDevice',{serverName,deviceName,className})
195%     tango_command_inout(dbserver,'DbDeleteDevice',deviceName);
196end
197
198
199liste = {
200'LT2/VI/VS40.1',
201'LT2/VI/VS63.2',
202'LT2/VI/VS40.3'};
203
204serverName = 'vacuumvalve/VS4LT2';
205className = 'VacuumValve';
206for k=1:length(liste),
207    deviceName = liste{k};
208    tango_command_inout2(dbserver,'DbAddDevice',{serverName,deviceName,className})
209%     tango_command_inout(dbserver,'DbDeleteDevice',deviceName);
210end
211
212liste = {
213'LT2/AE/D.1',
214'LT2/AE/Q.1',
215'LT2/AE/Q.2',
216'LT2/AE/Q.3',
217'LT2/AE/Q.4',
218'LT2/AE/Q.5',
219'LT2/AE/Q.6',
220'LT2/AE/Q.7',
221'LT2/AE/CV.1',
222'LT2/AE/CV.2',
223'LT2/AE/CV.3',
224'LT2/AE/CV.4',
225'LT2/AE/CV.5',
226'LT2/AE/CH.1',
227'LT2/AE/CH.2',
228'LT2/AE/CH.3'};
229
230serverName = 'ds_magnetsim/magnet4LT2';
231className = 'MagnetAlimSim';
232for k=1:length(liste),
233    deviceName = liste{k};
234    tango_command_inout2(dbserver,'DbAddDevice',{serverName,deviceName,className})
235%     tango_command_inout(dbserver,'DbDeleteDevice',deviceName);
236end
237
238liste = {
239'BOO-Binj/VI/PI55.1',
240'BOO-Binj/VI/PI55.2',
241'BOO-Binj/VI/PI300.3',
242'BOO-Binj/VI/PI55.4',
243'BOO-Binj/VI/PI55.5',
244'BOO-Binj/VI/PI55.6',
245'BOO-Binj/VI/PI500.7',
246'BOO-B1/VI/PI55.1',
247'BOO-B1/VI/PI55.2',
248'BOO-B1/VI/PI55.3',
249'BOO-B1/VI/PI55.4',
250'BOO-B1/VI/PI55.5',
251'BOO-B1/VI/PI55.6',
252'BOO-B1/VI/PI55.7',
253'BOO-B1/VI/PI55.8',
254'BOO-B1/VI/PI55.9',
255'BOO-B2/VI/PI55.1',
256'BOO-B2/VI/PI55.2',
257'BOO-B2/VI/PI55.3',
258'BOO-B2/VI/PI55.4',
259'BOO-B2/VI/PI55.5',
260'BOO-B2/VI/PI55.6',
261'BOO-B2/VI/PI55.7',
262'BOO-Bext/VI/PI55.1',
263'BOO-Bext/VI/PI55.2',
264'BOO-Bext/VI/PI300.3',
265'BOO-Bext/VI/PI55.4',
266'BOO-Bext/VI/PI55.5',
267'BOO-Bext/VI/PI55.6',
268'BOO-B3/VI/PI55.1',
269'BOO-B3/VI/PI55.2',
270'BOO-B3/VI/PI55.3',
271'BOO-B3/VI/PI55.4',
272'BOO-B3/VI/PI55.5',
273'BOO-B3/VI/PI55.6',
274'BOO-B3/VI/PI55.7',
275'BOO-B3/VI/PI55.8',
276'BOO-B4/VI/PI55.1',
277'BOO-B4/VI/PI55.2',
278'BOO-B4/VI/PI55.3',
279'BOO-B4/VI/PI55.4',
280'BOO-B4/VI/PI55.5',
281'BOO-B4/VI/PI55.6',
282'BOO-B4/VI/PI55.7'};
283
284serverName = 'ionpump/PI4BOOSTER';
285className = 'IonPump';
286for k=1:length(liste),
287    deviceName = liste{k};
288    tango_command_inout2(dbserver,'DbAddDevice',{serverName,deviceName,className})
289%     tango_command_inout(dbserver,'DbDeleteDevice',deviceName);
290end
291
292
293liste = {
294'BOO-Binj/VI/VS63.1',
295'BOO-Binj/VI/VS100.2',
296'BOO-B1/VI/VS100.1',
297'BOO-B2/VI/VS63.1',
298'BOO-Bext/VI/VS63.1',
299'BOO-B3/VI/VS63.1',
300'BOO-B4/VI/VS63.1'};
301
302serverName = 'vacuumvalve/VS4BOOSTER';
303className = 'VacuumValve';
304for k=1:length(liste),
305    deviceName = liste{k};
306    tango_command_inout2(dbserver,'DbAddDevice',{serverName,deviceName,className})
307%     tango_command_inout(dbserver,'DbDeleteDevice',deviceName);
308end
309
310liste = {
311'BOO-B1/VI/JPEN.1',
312'BOO-B1/VI/JPEN.2',
313'BOO-Binj/VI/JPEN.1',
314'BOO-Binj/VI/JPEN.2',
315'BOO-B2/VI/JPEN.1',
316'BOO-B2/VI/JPEN.2',
317'BOO-B2/VI/JPEN.3',
318'BOO-Bext/VI/JPEN.1',
319'BOO-Bext/VI/JPEN.2',
320'BOO-B3/VI/JPEN.1',
321'BOO-B3/VI/JPEN.2',
322'BOO-B4/VI/JPEN.1',
323'BOO-B4/VI/JPEN.2',
324'BOO-B4/VI/JPEN.3'};
325
326serverName = 'penninggauge/JPEN4BOOSTER';
327className = 'PenningGauge';
328for k=1:length(liste),
329    deviceName = liste{k};
330     tango_command_inout2(dbserver,'DbAddDevice',{serverName,deviceName,className})
331%     tango_command_inout(dbserver,'DbDeleteDevice',deviceName);
332end
333
334liste = {
335'BOO-B1/VI/JPIR.1',
336'BOO-Binj/VI/JPIR.1',
337'BOO-Binj/VI/JPIR.2',
338'BOO-B2/VI/JPIR.1',
339'BOO-Bext/VI/JPIR.1',
340'BOO-B3/VI/JPIR.1',
341'BOO-B4/VI/JPIR.1'};
342
343serverName = 'piranigauge/JPIR4BOOSTER';
344className = 'PiraniGauge';
345for k=1:length(liste),
346    deviceName = liste{k};
347     tango_command_inout2(dbserver,'DbAddDevice',{serverName,deviceName,className})
348%     tango_command_inout(dbserver,'DbDeleteDevice',deviceName);
349end
350
351liste = {
352'BOO-B1/VI/VS100.1',
353'BOO-Binj/VI/VS63.1',
354'BOO-Binj/VI/VS100.2',
355'BOO-B2/VI/VS63.1',
356'BOO-Bext/VI/VS63.1',
357'BOO-B3/VI/VS63.1',
358'BOO-B4/VI/VS63.1'};
359
360serverName = 'vacuumvalve/VS4BOOSTER';
361className = 'VacuumValve';
362for k=1:length(liste),
363    deviceName = liste{k};
364    tango_command_inout2(dbserver,'DbAddDevice',{serverName,deviceName,className})
365%     tango_command_inout(dbserver,'DbDeleteDevice',deviceName);
366end
367
Note: See TracBrowser for help on using the repository browser.