source: MML/trunk/mml/doc_html/mml/family2status.html @ 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: 14.9 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2                "http://www.w3.org/TR/REC-html40/loose.dtd">
3<html>
4<head>
5  <title>Description of family2status</title>
6  <meta name="keywords" content="family2status">
7  <meta name="description" content="FAMILY2STATUS - Returns the device status">
8  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
9  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
10  <meta name="robots" content="index, follow">
11  <link type="text/css" rel="stylesheet" href="../m2html.css">
12</head>
13<body>
14<a name="_top"></a>
15<div><a href="../index.html">Home</a> &gt;  <a href="index.html">mml</a> &gt; family2status.m</div>
16
17<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
18<td align="right"><a href="index.html">Index for mml&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
19
20<h1>family2status
21</h1>
22
23<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
24<div class="box"><strong>FAMILY2STATUS - Returns the device status</strong></div>
25
26<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
27<div class="box"><strong>function [S, IndexList] = family2status(Family, DeviceList) </strong></div>
28
29<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
30<div class="fragment"><pre class="comment">FAMILY2STATUS - Returns the device status
31  If using family name, device list method,
32  S = family2status(Family, DeviceList)
33
34  If using channel or tango name method,
35  S = family2status(ChannelNames)
36  S = family2status(TangoNames)
37
38  If using common name method,
39  S = family2status(Family, CommonName)
40
41  INPUTS 
42  1. Family = Family Name
43              Data Structure
44              Accelerator Object
45              Cell Array of Accelerator Objects or Family Names
46              For CommonNames, Family=[] searches all families
47              ChannelName = Channel access channel name
48                            Matrix of channel names
49                            Cell array of channel names
50  2. DeviceList = [Sector Device #] or [element #] list (Cell Array of DeviceList)
51                  {Default or empty list: whole family}
52     Note: The default list is different for this function then all other functions.
53           Usually the default is in service devices which would always be true if
54           that was the default for this function.
55
56  OUTPUTS
57  1. S = 1 - device is in service
58         0 - device is out of service
59         Empty if Family or CommonName is found not found
60  2. IndexList - Index vector relative to the device list where
61                 the device is in service.</pre></div>
62
63<!-- crossreference -->
64<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
65This function calls:
66<ul style="list-style-image:url(../matlabicon.gif)">
67<li><a href="common2dev.html" class="code" title="function [DeviceList, FamilyName, ErrorFlag] = common2dev(CommonNames, FamilyList)">common2dev</a>    COMMON2DEV - Converts a common name to a device list</li><li><a href="elem2dev.html" class="code" title="function Output = elem2dev(Family, ElementList)">elem2dev</a>  ELEM2DEV - Converts a device list to an element list</li><li><a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a>  FAMILY2DEV - Return the device list for a family</li><li><a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>        FAMILY2STATUS - Returns the device status</li><li><a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>    GETFAMILYDATA - Gets data associated with the accelerator control</li><li><a href="isfamily.html" class="code" title="function  [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a>        ISFAMILY - True for family names</li></ul>
68This function is called by:
69<ul style="list-style-image:url(../matlabicon.gif)">
70<li><a href="family2datastruct.html" class="code" title="function [DataStruct, ErrorFlag] = family2datastruct(varargin)">family2datastruct</a>  FAMILY2DATASTRUCTURE - Returns a datastructure corresponding to a Family</li><li><a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>        FAMILY2STATUS - Returns the device status</li><li><a href="monmags.html" class="code" title="function [MagnetSetpoints, MagnetMonitors, BPMMonitors, MagnetSetpointsEnd, FileName] = monmags(varargin)">monmags</a>     MONMAGS - Monitors all magnet power supplies and plots various statistics</li><li><a href="quadcenter.html" class="code" title="function [QMS1, QMS2] = quadcenter(QuadFamily, QuadDev, XYPlane, FigureHandle)">quadcenter</a>  QUADCENTER - Measure the magnet center of a quadrupole magnet</li><li><a href="setorbit.html" class="code" title="function [OCS, OCS0, V, S, ErrorFlag] = setorbit(varargin)">setorbit</a>      SETORBIT - Orbit correction function</li></ul>
71<!-- crossreference -->
72
73
74<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
75<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [S, IndexList] = family2status(Family, DeviceList)</a>
760002 <span class="comment">%FAMILY2STATUS - Returns the device status</span>
770003 <span class="comment">%  If using family name, device list method,</span>
780004 <span class="comment">%  S = family2status(Family, DeviceList)</span>
790005 <span class="comment">%</span>
800006 <span class="comment">%  If using channel or tango name method,</span>
810007 <span class="comment">%  S = family2status(ChannelNames)</span>
820008 <span class="comment">%  S = family2status(TangoNames)</span>
830009 <span class="comment">%</span>
840010 <span class="comment">%  If using common name method,</span>
850011 <span class="comment">%  S = family2status(Family, CommonName)</span>
860012 <span class="comment">%</span>
870013 <span class="comment">%  INPUTS</span>
880014 <span class="comment">%  1. Family = Family Name</span>
890015 <span class="comment">%              Data Structure</span>
900016 <span class="comment">%              Accelerator Object</span>
910017 <span class="comment">%              Cell Array of Accelerator Objects or Family Names</span>
920018 <span class="comment">%              For CommonNames, Family=[] searches all families</span>
930019 <span class="comment">%              ChannelName = Channel access channel name</span>
940020 <span class="comment">%                            Matrix of channel names</span>
950021 <span class="comment">%                            Cell array of channel names</span>
960022 <span class="comment">%  2. DeviceList = [Sector Device #] or [element #] list (Cell Array of DeviceList)</span>
970023 <span class="comment">%                  {Default or empty list: whole family}</span>
980024 <span class="comment">%     Note: The default list is different for this function then all other functions.</span>
990025 <span class="comment">%           Usually the default is in service devices which would always be true if</span>
1000026 <span class="comment">%           that was the default for this function.</span>
1010027 <span class="comment">%</span>
1020028 <span class="comment">%  OUTPUTS</span>
1030029 <span class="comment">%  1. S = 1 - device is in service</span>
1040030 <span class="comment">%         0 - device is out of service</span>
1050031 <span class="comment">%         Empty if Family or CommonName is found not found</span>
1060032 <span class="comment">%  2. IndexList - Index vector relative to the device list where</span>
1070033 <span class="comment">%                 the device is in service.</span>
1080034
1090035 <span class="comment">%</span>
1100036 <span class="comment">%  Written by Gregory J. Portmann</span>
1110037
1120038
1130039
1140040 <span class="keyword">if</span> nargin == 0
1150041     error(<span class="string">'At least one input required'</span>);
1160042 <span class="keyword">end</span>
1170043
1180044
1190045 <span class="comment">%%%%%%%%%%%%%%%%%%%%%</span>
1200046 <span class="comment">% Cell Array Inputs %</span>
1210047 <span class="comment">%%%%%%%%%%%%%%%%%%%%%</span>
1220048 <span class="keyword">if</span> iscell(Family)
1230049     <span class="keyword">for</span> i = 1:length(Family)
1240050         <span class="keyword">if</span> nargin &lt; 2
1250051             [S{i}, IndexList{i}] = <a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>(Family{i});
1260052         <span class="keyword">else</span>
1270053             <span class="keyword">if</span> iscell(DeviceList)
1280054                 [S{i}, IndexList{i}] = <a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>(Family{i}, DeviceList{i});
1290055             <span class="keyword">else</span>
1300056                 [S{i}, IndexList{i}] = <a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>(Family{i}, DeviceList);
1310057             <span class="keyword">end</span>
1320058         <span class="keyword">end</span>
1330059     <span class="keyword">end</span>
1340060     <span class="keyword">return</span>
1350061 <span class="keyword">end</span>
1360062
1370063
1380064 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
1390065 <span class="comment">% Family or data structure inputs beyond this point %</span>
1400066 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
1410067 <span class="keyword">if</span> isstruct(Family)
1420068     <span class="comment">% Data structure inputs</span>
1430069     <span class="keyword">if</span> nargin &lt; 2
1440070         <span class="keyword">if</span> isfield(Family,<span class="string">'DeviceList'</span>)
1450071             DeviceList = Family.DeviceList;
1460072         <span class="keyword">else</span>
1470073             DeviceList = [];
1480074         <span class="keyword">end</span>
1490075     <span class="keyword">end</span>
1500076     <span class="keyword">if</span> isfield(Family,<span class="string">'FamilyName'</span>)
1510077         Family = Family.FamilyName;
1520078     <span class="keyword">else</span>
1530079         error(<span class="string">'For data structure inputs FamilyName field must exist'</span>)
1540080     <span class="keyword">end</span>
1550081 <span class="keyword">else</span>
1560082     <span class="comment">% Family string input</span>
1570083     <span class="keyword">if</span> nargin &lt; 2
1580084         DeviceList = [];
1590085     <span class="keyword">end</span>
1600086 <span class="keyword">end</span>
1610087
1620088 <span class="comment">% Note: This is a different default than normal good status only</span>
1630089 <span class="keyword">if</span> <a href="isfamily.html" class="code" title="function  [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a>(Family)
1640090     <span class="keyword">if</span> isempty(DeviceList)
1650091         DeviceList = <a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a>(Family, 0);
1660092     <span class="keyword">end</span>
1670093     <span class="keyword">if</span> (size(DeviceList,2) == 1)
1680094         DeviceList = <a href="elem2dev.html" class="code" title="function Output = elem2dev(Family, ElementList)">elem2dev</a>(Family, DeviceList);
1690095     <span class="keyword">end</span>
1700096 <span class="keyword">end</span>
1710097
1720098
1730099 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%</span>
1740100 <span class="comment">% Channel / TANGO name method %</span>
1750101 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%</span>
1760102 <span class="keyword">if</span> ~<a href="isfamily.html" class="code" title="function  [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a>(Family(1,:))
1770103     <span class="comment">% Try to convert to a family and device</span>
1780104     
1790105     ChannelNames = Family;
1800106     <span class="keyword">for</span> i = 1:size(ChannelNames,1)
1810107         Family = tango2family(ChannelNames(i,:));
1820108 <span class="comment">%         Family = channel2family(ChannelNames(i,:));</span>
1830109         <span class="keyword">if</span> isempty(Family)
1840110             error(<span class="string">'Tango name could not be converted to a Family.'</span>);
1850111 <span class="comment">%             error('Channel name could not be converted to a Family.');</span>
1860112         <span class="keyword">end</span>
1870113         [FamilyIndex, ACCELERATOR_OBJECT] = <a href="isfamily.html" class="code" title="function  [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a>(Family);
1880114         DeviceList = tango2dev(ChannelNames(i,:), ACCELERATOR_OBJECT);
1890115 <span class="comment">%         DeviceList = channel2dev(ChannelNames(i,:), ACCELERATOR_OBJECT);</span>
1900116         <span class="keyword">if</span> isempty(DeviceList) | isempty(DeviceList)
1910117             error(<span class="string">'Tango name could not be converted to a Family and DeviceList.'</span>);
1920118 <span class="comment">%             error('Channel name could not be converted to a Family and DeviceList.');</span>
1930119         <span class="keyword">end</span>
1940120         S(i,:) = <a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>(Family, DeviceList);
1950121     <span class="keyword">end</span>
1960122     <span class="keyword">return</span>
1970123 <span class="keyword">end</span>
1980124
1990125
2000126 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2010127 <span class="comment">% CommonName Input:  Convert common names to a DeviceList %</span>
2020128 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2030129 <span class="keyword">if</span> isstr(DeviceList)
2040130     DeviceList = <a href="common2dev.html" class="code" title="function [DeviceList, FamilyName, ErrorFlag] = common2dev(CommonNames, FamilyList)">common2dev</a>(DeviceList, Family);
2050131     <span class="keyword">if</span> isempty(DeviceList)
2060132         error(<span class="string">'DeviceList was a string but common names could not be found.'</span>);
2070133     <span class="keyword">end</span>
2080134 <span class="keyword">end</span>
2090135
2100136   
2110137 <span class="comment">%%%%%%%%%%%%</span>
2120138 <span class="comment">% Get data %</span>
2130139 <span class="comment">%%%%%%%%%%%%</span>
2140140 S = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family, <span class="string">'Status'</span>, DeviceList);
2150141 S = S(:);
2160142 <span class="keyword">if</span> nargout &gt;= 2
2170143     IndexList = find(S==1);
2180144 <span class="keyword">end</span></pre></div>
219<hr><address>Generated on Mon 21-May-2007 15:29:18 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
220</body>
221</html>
Note: See TracBrowser for help on using the repository browser.