source: MML/trunk/mml/links/tango/tangogetrunflag.m

Last change on this file was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.4 KB
Line 
1function [RunFlag, Delta, Tol] = tangogetrunflag(Family, Field, DeviceList)
2% function TANGOGETRUNFLAG
3%
4%
5%  NOTES
6%  1. This function look at the tango state since if getpv, getam is too fast they return the same value before the PS
7%  start moving!
8
9TangoName = family2tangodev(Family, DeviceList);
10
11% 2. If Field = 'Setpoint', base on SP-AM tolerance
12if strcmp(Field, 'Setpoint')
13    % Base runflag on abs(Setpoint-Monitor) > Tol
14    Tol = family2tol(Family, Field, DeviceList, 'Hardware');
15    if isempty(Tol)
16        return;
17    end
18
19    RunFlag = zeros(size(Tol));
20   
21    % Check for first power supply still in running state
22    for k=1:length(TangoName),
23        val = readattribute([TangoName{k} '/State']);
24        if val == 10 % running state
25            RunFlag(k) = 1;       
26        end
27    end
28   
29        % Use the "real" Setpoint value
30    SP  = getpv(Family, 'Setpoint', DeviceList, 'Hardware');   
31    if isempty(SP)
32        return;
33    end
34    %SP = raw2real(Family, 'Monitor', SP, DeviceList); % Laurent
35
36    % Use the "real" Monitor value
37    AM  = getpv(Family, 'Monitor', DeviceList, 'Hardware');
38    if isempty(AM)
39        return;
40    end
41    %AM = raw2real(Family, 'Monitor', AM, DeviceList); % Laurent
42   
43    % Condition is now Tango Step + Tolerance
44    RunFlag = RunFlag | abs(SP-AM) > Tol;
45
46    %fprintf('SP=%f AM=%f\n', SP,AM);
47    Delta = SP-AM
48
49end
Note: See TracBrowser for help on using the repository browser.