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 © 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> > <a href="index.html">mml</a> > family2status.m</div> |
---|
16 | |
---|
17 | <!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td> |
---|
18 | <td align="right"><a href="index.html">Index for mml <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> |
---|
65 | This 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> |
---|
68 | This 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> |
---|
76 | 0002 <span class="comment">%FAMILY2STATUS - Returns the device status</span> |
---|
77 | 0003 <span class="comment">% If using family name, device list method,</span> |
---|
78 | 0004 <span class="comment">% S = family2status(Family, DeviceList)</span> |
---|
79 | 0005 <span class="comment">%</span> |
---|
80 | 0006 <span class="comment">% If using channel or tango name method,</span> |
---|
81 | 0007 <span class="comment">% S = family2status(ChannelNames)</span> |
---|
82 | 0008 <span class="comment">% S = family2status(TangoNames)</span> |
---|
83 | 0009 <span class="comment">%</span> |
---|
84 | 0010 <span class="comment">% If using common name method,</span> |
---|
85 | 0011 <span class="comment">% S = family2status(Family, CommonName)</span> |
---|
86 | 0012 <span class="comment">%</span> |
---|
87 | 0013 <span class="comment">% INPUTS</span> |
---|
88 | 0014 <span class="comment">% 1. Family = Family Name</span> |
---|
89 | 0015 <span class="comment">% Data Structure</span> |
---|
90 | 0016 <span class="comment">% Accelerator Object</span> |
---|
91 | 0017 <span class="comment">% Cell Array of Accelerator Objects or Family Names</span> |
---|
92 | 0018 <span class="comment">% For CommonNames, Family=[] searches all families</span> |
---|
93 | 0019 <span class="comment">% ChannelName = Channel access channel name</span> |
---|
94 | 0020 <span class="comment">% Matrix of channel names</span> |
---|
95 | 0021 <span class="comment">% Cell array of channel names</span> |
---|
96 | 0022 <span class="comment">% 2. DeviceList = [Sector Device #] or [element #] list (Cell Array of DeviceList)</span> |
---|
97 | 0023 <span class="comment">% {Default or empty list: whole family}</span> |
---|
98 | 0024 <span class="comment">% Note: The default list is different for this function then all other functions.</span> |
---|
99 | 0025 <span class="comment">% Usually the default is in service devices which would always be true if</span> |
---|
100 | 0026 <span class="comment">% that was the default for this function.</span> |
---|
101 | 0027 <span class="comment">%</span> |
---|
102 | 0028 <span class="comment">% OUTPUTS</span> |
---|
103 | 0029 <span class="comment">% 1. S = 1 - device is in service</span> |
---|
104 | 0030 <span class="comment">% 0 - device is out of service</span> |
---|
105 | 0031 <span class="comment">% Empty if Family or CommonName is found not found</span> |
---|
106 | 0032 <span class="comment">% 2. IndexList - Index vector relative to the device list where</span> |
---|
107 | 0033 <span class="comment">% the device is in service.</span> |
---|
108 | 0034 |
---|
109 | 0035 <span class="comment">%</span> |
---|
110 | 0036 <span class="comment">% Written by Gregory J. Portmann</span> |
---|
111 | 0037 |
---|
112 | 0038 |
---|
113 | 0039 |
---|
114 | 0040 <span class="keyword">if</span> nargin == 0 |
---|
115 | 0041 error(<span class="string">'At least one input required'</span>); |
---|
116 | 0042 <span class="keyword">end</span> |
---|
117 | 0043 |
---|
118 | 0044 |
---|
119 | 0045 <span class="comment">%%%%%%%%%%%%%%%%%%%%%</span> |
---|
120 | 0046 <span class="comment">% Cell Array Inputs %</span> |
---|
121 | 0047 <span class="comment">%%%%%%%%%%%%%%%%%%%%%</span> |
---|
122 | 0048 <span class="keyword">if</span> iscell(Family) |
---|
123 | 0049 <span class="keyword">for</span> i = 1:length(Family) |
---|
124 | 0050 <span class="keyword">if</span> nargin < 2 |
---|
125 | 0051 [S{i}, IndexList{i}] = <a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>(Family{i}); |
---|
126 | 0052 <span class="keyword">else</span> |
---|
127 | 0053 <span class="keyword">if</span> iscell(DeviceList) |
---|
128 | 0054 [S{i}, IndexList{i}] = <a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>(Family{i}, DeviceList{i}); |
---|
129 | 0055 <span class="keyword">else</span> |
---|
130 | 0056 [S{i}, IndexList{i}] = <a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>(Family{i}, DeviceList); |
---|
131 | 0057 <span class="keyword">end</span> |
---|
132 | 0058 <span class="keyword">end</span> |
---|
133 | 0059 <span class="keyword">end</span> |
---|
134 | 0060 <span class="keyword">return</span> |
---|
135 | 0061 <span class="keyword">end</span> |
---|
136 | 0062 |
---|
137 | 0063 |
---|
138 | 0064 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
139 | 0065 <span class="comment">% Family or data structure inputs beyond this point %</span> |
---|
140 | 0066 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
141 | 0067 <span class="keyword">if</span> isstruct(Family) |
---|
142 | 0068 <span class="comment">% Data structure inputs</span> |
---|
143 | 0069 <span class="keyword">if</span> nargin < 2 |
---|
144 | 0070 <span class="keyword">if</span> isfield(Family,<span class="string">'DeviceList'</span>) |
---|
145 | 0071 DeviceList = Family.DeviceList; |
---|
146 | 0072 <span class="keyword">else</span> |
---|
147 | 0073 DeviceList = []; |
---|
148 | 0074 <span class="keyword">end</span> |
---|
149 | 0075 <span class="keyword">end</span> |
---|
150 | 0076 <span class="keyword">if</span> isfield(Family,<span class="string">'FamilyName'</span>) |
---|
151 | 0077 Family = Family.FamilyName; |
---|
152 | 0078 <span class="keyword">else</span> |
---|
153 | 0079 error(<span class="string">'For data structure inputs FamilyName field must exist'</span>) |
---|
154 | 0080 <span class="keyword">end</span> |
---|
155 | 0081 <span class="keyword">else</span> |
---|
156 | 0082 <span class="comment">% Family string input</span> |
---|
157 | 0083 <span class="keyword">if</span> nargin < 2 |
---|
158 | 0084 DeviceList = []; |
---|
159 | 0085 <span class="keyword">end</span> |
---|
160 | 0086 <span class="keyword">end</span> |
---|
161 | 0087 |
---|
162 | 0088 <span class="comment">% Note: This is a different default than normal good status only</span> |
---|
163 | 0089 <span class="keyword">if</span> <a href="isfamily.html" class="code" title="function [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a>(Family) |
---|
164 | 0090 <span class="keyword">if</span> isempty(DeviceList) |
---|
165 | 0091 DeviceList = <a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a>(Family, 0); |
---|
166 | 0092 <span class="keyword">end</span> |
---|
167 | 0093 <span class="keyword">if</span> (size(DeviceList,2) == 1) |
---|
168 | 0094 DeviceList = <a href="elem2dev.html" class="code" title="function Output = elem2dev(Family, ElementList)">elem2dev</a>(Family, DeviceList); |
---|
169 | 0095 <span class="keyword">end</span> |
---|
170 | 0096 <span class="keyword">end</span> |
---|
171 | 0097 |
---|
172 | 0098 |
---|
173 | 0099 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
174 | 0100 <span class="comment">% Channel / TANGO name method %</span> |
---|
175 | 0101 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
176 | 0102 <span class="keyword">if</span> ~<a href="isfamily.html" class="code" title="function [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a>(Family(1,:)) |
---|
177 | 0103 <span class="comment">% Try to convert to a family and device</span> |
---|
178 | 0104 |
---|
179 | 0105 ChannelNames = Family; |
---|
180 | 0106 <span class="keyword">for</span> i = 1:size(ChannelNames,1) |
---|
181 | 0107 Family = tango2family(ChannelNames(i,:)); |
---|
182 | 0108 <span class="comment">% Family = channel2family(ChannelNames(i,:));</span> |
---|
183 | 0109 <span class="keyword">if</span> isempty(Family) |
---|
184 | 0110 error(<span class="string">'Tango name could not be converted to a Family.'</span>); |
---|
185 | 0111 <span class="comment">% error('Channel name could not be converted to a Family.');</span> |
---|
186 | 0112 <span class="keyword">end</span> |
---|
187 | 0113 [FamilyIndex, ACCELERATOR_OBJECT] = <a href="isfamily.html" class="code" title="function [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a>(Family); |
---|
188 | 0114 DeviceList = tango2dev(ChannelNames(i,:), ACCELERATOR_OBJECT); |
---|
189 | 0115 <span class="comment">% DeviceList = channel2dev(ChannelNames(i,:), ACCELERATOR_OBJECT);</span> |
---|
190 | 0116 <span class="keyword">if</span> isempty(DeviceList) | isempty(DeviceList) |
---|
191 | 0117 error(<span class="string">'Tango name could not be converted to a Family and DeviceList.'</span>); |
---|
192 | 0118 <span class="comment">% error('Channel name could not be converted to a Family and DeviceList.');</span> |
---|
193 | 0119 <span class="keyword">end</span> |
---|
194 | 0120 S(i,:) = <a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>(Family, DeviceList); |
---|
195 | 0121 <span class="keyword">end</span> |
---|
196 | 0122 <span class="keyword">return</span> |
---|
197 | 0123 <span class="keyword">end</span> |
---|
198 | 0124 |
---|
199 | 0125 |
---|
200 | 0126 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
201 | 0127 <span class="comment">% CommonName Input: Convert common names to a DeviceList %</span> |
---|
202 | 0128 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
203 | 0129 <span class="keyword">if</span> isstr(DeviceList) |
---|
204 | 0130 DeviceList = <a href="common2dev.html" class="code" title="function [DeviceList, FamilyName, ErrorFlag] = common2dev(CommonNames, FamilyList)">common2dev</a>(DeviceList, Family); |
---|
205 | 0131 <span class="keyword">if</span> isempty(DeviceList) |
---|
206 | 0132 error(<span class="string">'DeviceList was a string but common names could not be found.'</span>); |
---|
207 | 0133 <span class="keyword">end</span> |
---|
208 | 0134 <span class="keyword">end</span> |
---|
209 | 0135 |
---|
210 | 0136 |
---|
211 | 0137 <span class="comment">%%%%%%%%%%%%</span> |
---|
212 | 0138 <span class="comment">% Get data %</span> |
---|
213 | 0139 <span class="comment">%%%%%%%%%%%%</span> |
---|
214 | 0140 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); |
---|
215 | 0141 S = S(:); |
---|
216 | 0142 <span class="keyword">if</span> nargout >= 2 |
---|
217 | 0143 IndexList = find(S==1); |
---|
218 | 0144 <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> © 2003</address> |
---|
220 | </body> |
---|
221 | </html> |
---|