source: MML/trunk/machine/SOLEIL/StorageRing/bpm/getbpmgroup.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.4 KB
Line 
1function [AM, tout, DataTime, ErrorFlag] = getbpmgroup(varargin)
2%GETBPMGROUP - Gets vertical orbit read into valid BPMS using TANGO groups
3%
4%  INPUTS
5%  1. Familyname
6%  2. Field
7%  3. DeviceList - BPM devicelist
8%  4. time
9%
10%  OUTPUTS
11%  1. AM - horizontal beam position
12%
13% NOTES
14% First shot
15
16
17%
18% Written by Laurent S. Nadolski
19
20t0 = clock;  % starting time for getting data
21DataTime = 0;
22ErrorFlag = 1;
23Field = 'Monitor';
24DeviceListTotal = family2dev('BPMz');
25
26if isempty(varargin)
27    DeviceList = DeviceListTotal;
28else
29    DeviceList = varargin{3};
30end
31
32GroupID = getfamilydata('BPMx', 'GroupId');
33
34R = tango_group_read_attributes(GroupID, {'XPosSA', 'ZPosSA'}, 0);
35
36if tango_error
37    tango_print_error_stack;
38    ErrorFlag = 1;
39    tout = etime(clock, t0);
40    return;
41else
42    if R.has_failed > 0
43        ErrorFlag = 1;
44        for k=1:length(R.dev_replies),
45            if R.dev_replies(k).hasfailed
46                fprintf('BPM %s has failed \n', R.dev_replies(k).dev_name)
47            end
48        end
49        ErrorFlag = 1;
50        tout = etime(clock, t0);
51        return;
52    end
53end
54
55% construct data
56for k = 1:length(R.dev_replies),
57    AM(k,1) = R.dev_replies(k).attr_values(1).value(1);
58end
59
60tout = etime(clock, t0);
61DataTime = R.dev_replies(1).attr_values(1).time; %time when data was measured accordint to Tango system
62Status = findrowindex(DeviceList, DeviceListTotal);
63AM = AM(Status);
Note: See TracBrowser for help on using the repository browser.