source: MML/trunk/machine/SOLEIL/StorageRing/tune/gettuneFBT.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.5 KB
Line 
1function [Tune, tout, DataTime, ErrorFlag] = gettuneFBT(varargin)
2%GETTUNE - Returns the betatron tunes
3%  | Higher Fractional Tune (X) |
4%  |                            | = gettune(t, FreshDataFlag, TimeOutPeriod)
5%  |  Lower Fractional Tune (Y) |
6%
7%  INPUTS
8%  1. t, FreshDataFlag, TimeOutPeriod (see help getpv for details)
9%  2. 'Struct'  - Output will be a response matrix structure
10%     'Numeric' - Output will be a numeric matrix {default}
11%  3. Optional override of the units:
12%     'Physics'  - Use physics  units
13%     'Hardware' - Use hardware units
14%  4. Optional override of the mode:
15%     'Online'    - Get data online 
16%     'Simulator' - Get data on the simulated accelerator using AT
17%     'Model'     - Same as 'Simulator'
18%     'Manual'    - Get data manually
19%
20%  OUTPUTS
21%  1. Fractional tune
22%  2. tout     (see help getpv for details)
23%  3. DataTime (see help getpv for details)
24%  4. ErrorFlag =  0   -> no errors
25%                 else -> error or warning occurred
26%
27%  NOTES
28%  1. An easy way to measure N averaged tunes is mean(gettune(1:2:N)')' (2 seconds between measurements)
29%
30% See also steptune, settune
31
32%
33% Written by Gregory J. Portmann
34% Modified by Laurent S. Nadolski
35
36% [Tune, tout] = gettune(varargin);
37% return;
38
39DisplayFlag = 0;
40for i = length(varargin):-1:1
41    if isstruct(varargin{i})
42        % Ignore structures
43    elseif iscell(varargin{i})
44        % Ignore cells
45    elseif strcmpi(varargin{i},'Display')
46        DisplayFlag = 1;
47        varargin(i) = [];
48    elseif strcmpi(varargin{i},'NoDisplay')
49        DisplayFlag = 0;
50        varargin(i) = [];
51    end
52end
53
54% TO BE REMOVED when TANGO BUG corrected on tunemeasurement device
55%devProxyDataX  = 'ANS/RF/BBFDATAVIEWER.1';
56% Modification 17 February 2010 with. Rajesh
57devProxyDataX  = 'ANS/RF/BBFDATAVIEWER.3';
58devProxyDataZ  = 'ANS/RF/BBFDATAVIEWER.2';
59
60if tango_ping(devProxyDataX) == -1 || tango_ping(devProxyDataZ) == -1
61    ErrorFlag = -1;
62    Tune = [NaN; NaN];
63    tango_print_error_stack
64else
65    % get betatron tunes from FBT
66    [Tune, tout, DataTime] = getpv('TUNEFBT', 'Monitor', [1 1; 1 2], varargin{:});
67end
68
69%% Complete structure
70if isstruct(Tune)
71    TuneUnitsString = getfamilydata('TUNEFBT','Monitor','HWUnits');
72    if isempty(TuneUnitsString)
73        Tune.UnitsString = 'Fractional Tune';
74    else
75        Tune.UnitsString = TuneUnitsString;
76    end
77    Tune.DataDescriptor = 'TUNEFBT';
78    Tune.CreatedBy = 'gettune';
79end
80
81%% Display to the screen
82if DisplayFlag
83   fprintf('\n  Horizontal Tune = %f\n', Tune(1));
84   fprintf('    Vertical Tune = %f\n\n', Tune(2));
85end
86
Note: See TracBrowser for help on using the repository browser.