source: MML/trunk/machine/SOLEIL/StorageRing/bpm/getsnifferorbit.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: 1.5 KB
Line 
1function [xOrbit zOrbit ErrorFlag] = getsnifferorbit(varargin)
2%GETSNIFFERORBIT - read orbit on sniffer and retrieve sniffer golden orbit
3%
4%  OUPUTS
5%  1.  xOrbit - Horizontal orbit
6%  2.  zOrbit - Vertical orbit
7%  3.  ErrorFlag  - 0 if OK
8%
9%  NOTES
10%  the sniffer board gives the orbit difference
11%  to get the orbit one needs to retrieve the golden orbit of the sniffer (FOFB)
12%
13%
14%  See Also getsnifferoffset, getsnifferoffset
15
16%  TODO
17%  DisplayFlag
18
19%
20%% Written by Laurent S. Nadolski
21
22ErrorFlag = 0;
23DisplayFlag = 0;
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[xDiffOrbit zDiffOrbit ErrorFlag] = getsnifferdifforbit;
35
36if ~ErrorFlag
37    % Load last golden orbit used by the sniffer board and the FOFB
38    dirName = '/home/operateur/GrpDiagnostics/matlab/FOFB/GUI/golden/';
39    fileName = 'last_golden';
40    A = load([dirName fileName]);
41
42    % Orbit read on the sniffer board expressed in mm without BBA offsets
43    xOrbit = (xDiffOrbit + A.last_goldenX')*1e-6;
44    zOrbit = (zDiffOrbit + A.last_goldenZ')*1e-6;
45
46    if DisplayFlag
47        figure
48        spos = getspos('BPMx');
49        plot(spos,xOrbit,'b'); hold on; grid on;
50        plot(spos,zOrbit,'r');
51        xlabel('s-position (m)');
52        ylabel('Position (mm)');
53        legend('H-plane', 'V-plane');
54        title('Orbit read on orbit sniffer')
55
56    end
57else
58    xOrbit = -1;
59    zOrbit = -1;
60    ErrorFlag = 1;
61end
Note: See TracBrowser for help on using the repository browser.