1 | function [X Z] = getbpmBN(varargin) |
---|
2 | % GETBPMBN - get injection or extraction BPM in Booster normal mode |
---|
3 | % |
---|
4 | % |
---|
5 | % INPUTS |
---|
6 | % 1. Injection - Orbit at injection {Default} |
---|
7 | % Extraction - Orbit at extraction |
---|
8 | % 2. Display - Displays orbit {Default} |
---|
9 | % NoDisplay |
---|
10 | % |
---|
11 | % OUTPUTS |
---|
12 | % 1. X - Horizontal orbit |
---|
13 | % 2. Z - Vertical orbit |
---|
14 | % |
---|
15 | % |
---|
16 | |
---|
17 | % |
---|
18 | % Written By Laurent S. Nadolski |
---|
19 | |
---|
20 | |
---|
21 | InjectionFlag = 1; |
---|
22 | DisplayFlag = 1; |
---|
23 | |
---|
24 | for i = length(varargin):-1:1 |
---|
25 | if strcmpi(varargin{i},'Display') |
---|
26 | DisplayFlag = 1; |
---|
27 | varargin2 = {varargin2{:} varargin{i}}; |
---|
28 | varargin(i) = []; |
---|
29 | elseif strcmpi(varargin{i},'NoDisplay') |
---|
30 | DisplayFlag = 0; |
---|
31 | varargin2 = {varargin2{:} varargin{i}}; |
---|
32 | varargin(i) = []; |
---|
33 | elseif strcmpi(varargin{i},'Injection') |
---|
34 | InjectionFlag = 1; |
---|
35 | elseif strcmpi(varargin{i},'Extraction') |
---|
36 | InjectionFlag = 0; |
---|
37 | end |
---|
38 | end |
---|
39 | |
---|
40 | |
---|
41 | if (InjectionFlag) |
---|
42 | Rep = tango_read_attribute2('BOO/DG/BPM-MANAGER','xInj'); |
---|
43 | X = Rep.value; |
---|
44 | |
---|
45 | Rep = tango_read_attribute2('BOO/DG/BPM-MANAGER','zInj'); |
---|
46 | Z = Rep.value; |
---|
47 | stitle=('Booster orbit at injection'); |
---|
48 | else |
---|
49 | Rep = tango_read_attribute2('BOO/DG/BPM-MANAGER','xExt'); |
---|
50 | X = Rep.value; |
---|
51 | |
---|
52 | Rep = tango_read_attribute2('BOO/DG/BPM-MANAGER','zExt'); |
---|
53 | Z = Rep.value; |
---|
54 | stitle=('Booster orbit at extraction'); |
---|
55 | end |
---|
56 | |
---|
57 | if DisplayFlag |
---|
58 | figure(102); |
---|
59 | posvect = getspos('BPMx'); |
---|
60 | h1 = subplot(7,1,[1 3]); |
---|
61 | plot(posvect, X,'r.-'); |
---|
62 | grid on |
---|
63 | ylabel('X (mm)'); |
---|
64 | axis([0 getcircumference -4 4]); |
---|
65 | title(stitle); |
---|
66 | |
---|
67 | h2 = subplot(7,1,4); |
---|
68 | drawlattice; hold on; |
---|
69 | set(h2,'XTick',[],'YTick',[]); |
---|
70 | |
---|
71 | h3 = subplot(7,1,[5 7]); |
---|
72 | plot(posvect, Z,'b.-'); |
---|
73 | grid on |
---|
74 | xlabel('s (mm)') |
---|
75 | ylabel('Z (mm)'); |
---|
76 | |
---|
77 | % links axes |
---|
78 | linkaxes([h1 h2 h3],'x'); |
---|
79 | addlabel(1,0,datestr(clock)); |
---|
80 | |
---|
81 | end |
---|