source: MML/trunk/machine/SOLEIL/StorageRing/KEM/set_BPM_configuration_FMA_ON.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: 3.5 KB
Line 
1function set_BPM_configuration_FMA_ON
2%
3% 8 juillet 2008
4% configure une liste de BPM pour les mesures tour par tour
5% nécessaire à l'analyse en fréquence
6%
7% RETUNE
8% modifie le SWITCH
9% modifie la profondeur de buffer
10% mode DDenabled
11% ajuste les retards fins de phase :!! a une incidence sur FOFB PENSER A REMETTRE TOUT EN ORDRE
12% mode AGC off
13% gain fixé de façon à avoir 1e8 = signal somme pour 10 mA sur 95 ns
14%
15
16%  NOTES
17%  Injection in quart 2 with Linac pulse of 1.5nC 110MeV 90ns
18
19
20DDFlag = 1; % for standard filter
21actual_directory = pwd;
22cd('/home/operateur/GrpDiagnostics/matlab/DserverBPM')
23
24%% LISTE BPM
25% liste de BPM
26%devList = getBPMlist4FMA;
27devList = family2tangodev('BPMx');
28
29%% cree un tango group des BPM concernés
30GroupId = tango_group_create2('BPM_FMA');
31tango_group_add(GroupId,devList');
32tango_group_ping(GroupId)
33disp('Tango Group achieved')
34
35%% profondeur de buffer
36%Value=uint32(2000);
37% Value=int32(2000);
38% attribute = 'DDBufferSize';
39% tango_group_write_attribute2(GroupId,attribute,Value);
40% disp('DDBufferSize equal to 2000')
41
42%% retune
43h = waitbar(0,'Please wait...');
44for i=1:1:size(devList,1)
45
46    waitbar(i/size(devList,1));
47    libera_ip = tango_get_property2(devList{i},'LiberaIpAddr')
48   
49    % fichier où l'on va écrire l'adresse des BPM une à une
50    fid=fopen('liste-IP-libera-test.txt','wt');   
51    fprintf(fid,libera_ip.value{1});
52    fclose(fid);
53   
54    % script de commande unix
55   
56    command='.  Retune_liste.sh liste-IP-libera-test.txt';   
57    [status,result]=unix(command,'-echo');
58   
59    % test
60    detune_index=regexp(result,' -o ');
61    if isempty(detune_index)
62        val_list(i,:)=[devList{i}(5:8),devList{i}(12:16),' no detuning'];
63    else
64        ligne=[result(detune_index+1:detune_index+5),'      '];
65        val_list(i,:)=[devList{i}(5:8),devList{i}(12:16),' ',ligne];
66    end
67end
68disp(val_list); % afficher le résultat
69
70% C01/BPM.1 -o 0       
71% C01/BPM.2 -o 0       
72% C01/BPM.4 -o 0       
73% C02/BPM.5 -o 0       
74% C09/BPM.1 -o 0       
75% C09/BPM.2 -o 0 
76
77%% SWITCH + DD Buffer size à modifier ultérieurement en tango_group
78% TODO put BPM device list as input argument
79switchbpm('KEM');  % ATTENTION PERTURBATION IMPORTANTE DU FAISCEAU STOCKE
80
81%% DD enabled
82Value=uint8(1);
83attribute = 'DDEnabled';
84tango_group_write_attribute2(GroupId,attribute,Value);
85disp('DDenabled achieved')
86MeanVal = mean(tango_group_read_attribute2(GroupId, attribute));
87if MeanVal ~= double(Value);
88    fprintf('At least one BPM is not DD enabled \n')
89end
90pause(0.5)
91
92%% AGC not enabled
93Value=uint8(0);
94attribute = 'AGCEnabled';
95tango_group_write_attribute2(GroupId,attribute,Value);
96disp('AGC off')
97MeanVal = mean(tango_group_read_attribute2(GroupId, attribute));
98if MeanVal ~= double(Value);
99    fprintf('At least one BPM has AGC set off \n')
100end
101pause(0.5)
102
103%% valeur du gain
104Value=-22;
105attribute = 'Gain';
106tango_group_write_attribute2(GroupId,attribute,Value);
107disp('Gain fixed to -22')
108
109MeanVal = mean(tango_group_read_attribute2(GroupId, attribute));
110if MeanVal ~= double(Value);
111    fprintf('At least one BPM has gain different from %d \n', Value)
112end
113pause(0.5)
114
115%% retard fin  à modifier ultérieurement en tango_group
116if DDFlag
117    cd('/home/matlabML/measdata/SOLEIL/StorageRingdata/KickerEM/')
118    set_bpm_timephase;
119    disp('BPM Phases tuned')
120end
121
122fprintf('Penser à remettre les phases à 0 en fin de FMA (standard pour FOFB)\n')
123cd(actual_directory)
124
125%% faire disparaitre le groupe tango
126tango_group_kill(GroupId);
127disp('Tango Group killed')
128disp('BPM Configuration completed')
Note: See TracBrowser for help on using the repository browser.