source: MML/trunk/machine/SOLEIL/StorageRing/insertions/idBPMIndConvForSOLEIL.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.4 KB
Line 
1function convIndBPM = idBPMIndConvForSOLEIL(indBPM)
2%Converts 1-based absolute BPM number (1 - 120) to its section and rel.
3%number, and the other way around, depending on length(indBPM)
4
5arBPM = {...
6    [1 1],[1 2],[1 3],[1 4],[1 5],[1 6],[1 7],...
7        [2 1],[2 2],[2 3],[2 4],[2 5],[2 6],[2 7],[2 8],...
8        [3 1],[3 2],[3 3],[3 4],[3 5],[3 6],[3 7],[3 8],...
9    [4 1],[4 2],[4 3],[4 4],[4 5],[4 6],[4 7],...
10    [5 1],[5 2],[5 3],[5 4],[5 5],[5 6],[5 7],...
11        [6 1],[6 2],[6 3],[6 4],[6 5],[6 6],[6 7],[6 8],...
12        [7 1],[7 2],[7 3],[7 4],[7 5],[7 6],[7 7],[7 8],...
13    [8 1],[8 2],[8 3],[8 4],[8 5],[8 6],[8 7],...
14    [9 1],[9 2],[9 3],[9 4],[9 5],[9 6],[9 7],...
15        [10 1],[10 2],[10 3],[10 4],[10 5],[10 6],[10 7],[10 8],...
16        [11 1],[11 2],[11 3],[11 4],[11 5],[11 6],[11 7],[11 8],...
17        [12 1],[12 2],[12 3],[12 4],[12 5],[12 6],[12 7],...
18        [13 1],[13 2],[13 3],[13 4],[13 5],[13 6],[13 7],...
19        [14 1],[14 2],[14 3],[14 4],[14 5],[14 6],[14 7],[14 8],...
20        [15 1],[15 2],[15 3],[15 4],[15 5],[15 6],[15 7],[15 8],...
21        [16 1],[16 2],[16 3],[16 4],[16 5],[16 6],[16 7],...
22};
23
24mode = length(indBPM);
25if(mode < 1)
26    convIndBPM = 0;
27    return;
28elseif(mode == 1)
29    convIndBPM = arBPM{indBPM};
30    return;
31end
32
33numBPMs = length(arBPM);
34convIndBPM = 0;
35for i = 1:numBPMs
36    curRelBPM = arBPM{i};
37    if(indBPM(1) == curRelBPM(1))
38        if(indBPM(2) == curRelBPM(2))
39            convIndBPM = i;
40            return;
41        end
42    end
43end
44
45
Note: See TracBrowser for help on using the repository browser.