1 | function monbpmhistory_normbeta(varargin) |
---|
2 | % monbpmhistory_normbeta - Read historybuffer of all the BPMs |
---|
3 | % |
---|
4 | |
---|
5 | %% |
---|
6 | if isempty(varargin) |
---|
7 | devName = family2tangodev('BPMx'); |
---|
8 | else |
---|
9 | devName = family2tangodev('BPMx',varargin{:}); |
---|
10 | end |
---|
11 | |
---|
12 | %% |
---|
13 | Xpos = []; |
---|
14 | Zpos = []; |
---|
15 | Xrmspos = []; |
---|
16 | Zrmspos = []; |
---|
17 | |
---|
18 | % recup fonction beta |
---|
19 | [BetaX, BetaY] = modelbeta('BPMx'); |
---|
20 | |
---|
21 | for k = 1:length(devName), |
---|
22 | %rep = tango_read_attributes(devName{k},{'XPosSAHistory','ZPosSAHistory','XRMSPosSA','ZRMSPosSA'}); |
---|
23 | rep = tango_read_attributes(devName{k},{'XPosSAHistory','ZPosSAHistory'}); |
---|
24 | Xpos(:,k) = rep(1).value/sqrt(BetaX(k)); |
---|
25 | Zpos(:,k) = rep(2).value/sqrt(BetaY(k)); |
---|
26 | end |
---|
27 | |
---|
28 | Xrmspos = std(Xpos); |
---|
29 | Zrmspos = std(Zpos); |
---|
30 | |
---|
31 | xtime = (1:size(Xpos,1))/10; |
---|
32 | %% |
---|
33 | figure |
---|
34 | subplot(2,2,1) |
---|
35 | plot(xtime, Xpos-repmat(Xpos(1,:),size(Xpos,1),1)) |
---|
36 | xaxis([1 size(Xpos,1)/10]) |
---|
37 | ylabel('DX (mm)') |
---|
38 | xlabel('time [s]') |
---|
39 | grid on |
---|
40 | subplot(2,2,2) |
---|
41 | plot(Xrmspos) |
---|
42 | xaxis([0 size(Xpos,2)+1]) |
---|
43 | ylabel('Xrms (mm)') |
---|
44 | xlabel('BPM number') |
---|
45 | grid on |
---|
46 | subplot(2,2,3) |
---|
47 | plot(xtime, Zpos-repmat(Zpos(1,:),size(Zpos,1),1)) |
---|
48 | xaxis([1 size(Xpos,1)/10]) |
---|
49 | ylabel('DZ (mm)') |
---|
50 | xlabel('time [s]') |
---|
51 | grid on |
---|
52 | subplot(2,2,4) |
---|
53 | plot(Zrmspos) |
---|
54 | xaxis([0 size(Xpos,2)+1]) |
---|
55 | ylabel('Zrms (mm)') |
---|
56 | xlabel('BPM number') |
---|
57 | grid on |
---|
58 | |
---|
59 | addlabel(datestr(tango_shift_time(rep(2).time))) |
---|