source: MML/trunk/machine/SOLEIL/Booster/gettrackingdata.m @ 17

Last change on this file since 17 was 17, checked in by zhangj, 10 years ago

To have a stable version on the server.

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1function [D1 D2 QF QD itime] = gettrackingdata(varargin)
2% GETTRACKING - get measured current on D1 D2 QD and QF
3%
4%  INPUTS
5%
6%
7%  OUTPUTS
8%  1. D1 -  Measured current on Dipole D1  in A
9%  2. D2 -  Measured current on Dipole D2 in A
10%  3. QF -  Measured current on quadrupole QF in A
11%  4. QD -  Measured current on quadrupole QD in A
12%  5. itime - Time base in seconds
13%
14% NOTES
15% 1. Voltages are between -10 and 10 V and converted into amperes
16% 2/ time base is reconstruced by reading frequency and bufferdepth on
17% dserver tracking
18
19DisplayFlag = 1;
20
21% Input parser
22
23for i = length(varargin):-1:1
24    if strcmpi(varargin{i},'Display')
25        DisplayFlag = 1;
26        varargin(i) = [];
27    elseif strcmpi(varargin{i},'NoDisplay')
28        DisplayFlag = 0;
29        varargin(i) = [];
30    end
31end
32
33devName = 'BOO/AE/tracking';
34% use this function to assure synchronous reading
35val = tango_read_attributes(devName, ...
36    {'channel0','channel1','channel2','channel3','frequency','bufferDepth'});
37
38if (tango_error == -1)
39    %- handle error
40    tango_print_error_stack;
41    return
42end
43
44
45% Gets numerical values for current (it is a voltage with is read)
46% D.1 D.2 QF QD
47
48D1 = val(1).value*-56; % -55 A/V
49D2 = val(2).value*-56; % -55 A/V
50QF = val(3).value*-25; % -25 A/V
51QD = val(4).value*-25;  % -10 A/V
52
53freq       = val(5).value(1); % read value
54timeTot = val(6).value(1); % read value
55
56itime = 0:1/freq:timeTot;
57itime = itime(2:end);
58
59
60if DisplayFlag
61    subplot(2,1,1)
62    plot(itime,(D1+D2)/2,itime,QF,itime,QD);
63    grid on
64    legend('(D1+D2)/2','QF','QD')
65    xlabel('time (s)')
66%     xlim([0.03 0.05])
67    hold off
68    ylabel('normalized voltage (-10V to 10 V)')
69    title(['Dipole = ' num2str(max(D1+D2)/2) ' QF = ' num2str(max(QF)) ' QD = '  num2str(max(QD))])
70    subplot(2,1,2)
71    plot(itime,QD./((D1+D2)/2),itime,QF./((D1+D2)/2));
72    %hold off
73    xlim([0.0 0.03])
74    grid on
75    legend('QD/Dipole','QF/Dipole')
76    xlabel('time (s)')
77    ylabel('normalized voltage (-10V to 10 V)')
78       
79end
Note: See TracBrowser for help on using the repository browser.