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