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 elem2dev</title> |
---|
6 | <meta name="keywords" content="elem2dev"> |
---|
7 | <meta name="description" content="ELEM2DEV - Converts a device list to an element list"> |
---|
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> > elem2dev.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>elem2dev |
---|
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>ELEM2DEV - Converts a device list to an element list</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 Output = elem2dev(Family, ElementList) </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">ELEM2DEV - Converts a device list to an element list |
---|
31 | [Sector Device#] = elem2dev(Family, Element#) |
---|
32 | |
---|
33 | This function convects between the two methods of representing |
---|
34 | the same device in the ring. The "Device" method is a two column |
---|
35 | matrix with the first being sector number and the seconds being |
---|
36 | the device number in the sector. The "Element" method is a one column |
---|
37 | matrix with each entry being the element number starting at sector 1. |
---|
38 | |
---|
39 | The following are equivalent devices for VCMs at the ALS: |
---|
40 | | 1 2 | | 2 | |
---|
41 | | 1 3 | | 3 | |
---|
42 | [Sector Device#] = | 2 1 | [ElementList] = | 9 | |
---|
43 | | 2 2 | | 10 | |
---|
44 | | 3 4 | | 20 | |
---|
45 | |
---|
46 | NOTES |
---|
47 | 1. If ElementList is empty, the entire family list will be returned. |
---|
48 | 2. If the device is not found, then an error will occur. |
---|
49 | 3. If the Family is not found, then empty, [], is returned. |
---|
50 | |
---|
51 | Written by Greg Portmann</pre></div> |
---|
52 | |
---|
53 | <!-- crossreference --> |
---|
54 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
55 | This function calls: |
---|
56 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
57 | <li><a href="getlist.html" class="code" title="function DeviceList = getlist(varargin)">getlist</a> GETLIST - Returns Device List for a Family</li><li><a href="isfamily.html" class="code" title="function [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a> ISFAMILY - True for family names</li></ul> |
---|
58 | This function is called by: |
---|
59 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
60 | <li><a href="amp2mm.html" class="code" title="function mm = amp2mm(CMfamily, Amps, CMDevList, varargin)">amp2mm</a> AMPS2MM - Returns the maximum millimeter orbit change per change in corrector</li><li><a href="checklimits.html" class="code" title="function [LimitFlag, LimitList] = checklimits(varargin)">checklimits</a> CHECKLIMITS - Checks if the setpoint will exceed a limit</li><li><a href="dev2common.html" class="code" title="function [Output, Err] = dev2common(Family, DeviceList)">dev2common</a> DEV2COMMON - Converts Device lists to common names</li><li><a href="family2handle.html" class="code" title="function [Handles, ErrorFlag] = family2handle(Family, Field, DeviceList);">family2handle</a> [Handles, ErrorFlag] = family2handle(Family, Field, DeviceList)</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="getdata.html" class="code" title="function [S, FileName] = getdata(varargin)">getdata</a> GETDATA - Searches through a file (or group of files) for a data structure which matches the family name</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="getgolden.html" class="code" title="function Data = getgolden(varargin)">getgolden</a> GETGOLDEN - Returns the golden values for a family</li><li><a href="getpv.html" class="code" title="function [AM, tout, DataTime, ErrorFlag] = getpv(varargin)">getpv</a> GETPV - Returns a variable from the online system or the model</li><li><a href="getrespmat.html" class="code" title="function [S, FileName] = getrespmat(varargin)">getrespmat</a> GETRESPMAT - Get response matrix data from a file</li><li><a href="getsigma.html" class="code" title="function [Data, FileName] = getsigma(varargin)">getsigma</a> GETSIGMA - Return the standard deviation in the monitor for a family</li><li><a href="inputparsingffd.html" class="code" title="function [Family, Field, DeviceList, UnitsFlag, ModelFlag] = inputparsingffd(varargin)">inputparsingffd</a> INPUTPARSINGFFD - Parses the typical input line of Family, Field, DeviceList</li><li><a href="loadorbit.html" class="code" title="function varargout = loadorbit(varargin)">loadorbit</a> LOADORBIT - Loads orbit by file/directory specification - or - Golden %orbit by default</li><li><a href="measrespmat.html" class="code" title="function S = measrespmat(varargin)">measrespmat</a> MEASRESPMAT - Measure a response matrix</li><li><a href="mm2amp.html" class="code" title="function Amps = mm2amp(CMfamily, mm, CMDevList, varargin)">mm2amp</a> MM2AMPS - Returns the change in corrector need for a maximum orbit change</li><li><a href="monrate.html" class="code" title="function [AvgRate, N] = monrate(family, DeviceList, T);">monrate</a> MONRATE - Calculates the control system data rate of a noisy channel</li><li><a href="raw2real.html" class="code" title="function DataOut = raw2real(varargin)">raw2real</a> RAW2REAL - Converts raw control system data to calibrated values</li><li><a href="real2raw.html" class="code" title="function DataOut = real2raw(varargin)">real2raw</a> REAL2RAW - Converts "real" data (calibrated values) to control system data</li><li><a href="rmgolden.html" class="code" title="function Data = rmgolden(varargin)">rmgolden</a> RMGOLDEN - Remove the golden values for data set</li><li><a href="rmoffset.html" class="code" title="function Data = rmoffset(varargin)">rmoffset</a> RMOFFSET - Remove the offset values for data set</li><li><a href="setfamilydata.html" class="code" title="function setfamilydata(Data, Family, Field1, Field2, DeviceList)">setfamilydata</a> SETFAMILYDATA - Sets data associated with accelerator control</li><li><a href="setphysdata.html" class="code" title="function setphysdata(varargin)">setphysdata</a> SETPHYSDATA - Set physics data</li><li><a href="setpv.html" class="code" title="function ErrorFlag = setpv(varargin)">setpv</a> SETPV - Setpoint change of the online system or model</li></ul> |
---|
61 | <!-- crossreference --> |
---|
62 | |
---|
63 | |
---|
64 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
65 | <div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function Output = elem2dev(Family, ElementList)</a> |
---|
66 | 0002 <span class="comment">%ELEM2DEV - Converts a device list to an element list</span> |
---|
67 | 0003 <span class="comment">% [Sector Device#] = elem2dev(Family, Element#)</span> |
---|
68 | 0004 <span class="comment">%</span> |
---|
69 | 0005 <span class="comment">% This function convects between the two methods of representing</span> |
---|
70 | 0006 <span class="comment">% the same device in the ring. The "Device" method is a two column</span> |
---|
71 | 0007 <span class="comment">% matrix with the first being sector number and the seconds being</span> |
---|
72 | 0008 <span class="comment">% the device number in the sector. The "Element" method is a one column</span> |
---|
73 | 0009 <span class="comment">% matrix with each entry being the element number starting at sector 1.</span> |
---|
74 | 0010 <span class="comment">%</span> |
---|
75 | 0011 <span class="comment">% The following are equivalent devices for VCMs at the ALS:</span> |
---|
76 | 0012 <span class="comment">% | 1 2 | | 2 |</span> |
---|
77 | 0013 <span class="comment">% | 1 3 | | 3 |</span> |
---|
78 | 0014 <span class="comment">% [Sector Device#] = | 2 1 | [ElementList] = | 9 |</span> |
---|
79 | 0015 <span class="comment">% | 2 2 | | 10 |</span> |
---|
80 | 0016 <span class="comment">% | 3 4 | | 20 |</span> |
---|
81 | 0017 <span class="comment">%</span> |
---|
82 | 0018 <span class="comment">% NOTES</span> |
---|
83 | 0019 <span class="comment">% 1. If ElementList is empty, the entire family list will be returned.</span> |
---|
84 | 0020 <span class="comment">% 2. If the device is not found, then an error will occur.</span> |
---|
85 | 0021 <span class="comment">% 3. If the Family is not found, then empty, [], is returned.</span> |
---|
86 | 0022 <span class="comment">%</span> |
---|
87 | 0023 <span class="comment">% Written by Greg Portmann</span> |
---|
88 | 0024 |
---|
89 | 0025 |
---|
90 | 0026 <span class="keyword">if</span> nargin == 0 |
---|
91 | 0027 error(<span class="string">'One input required.'</span>); |
---|
92 | 0028 <span class="keyword">end</span> |
---|
93 | 0029 <span class="keyword">if</span> nargin == 1 |
---|
94 | 0030 Output = <a href="getlist.html" class="code" title="function DeviceList = getlist(varargin)">getlist</a>(Family); |
---|
95 | 0031 <span class="keyword">return</span> |
---|
96 | 0032 <span class="keyword">end</span> |
---|
97 | 0033 <span class="keyword">if</span> isempty(ElementList) |
---|
98 | 0034 Output = <a href="getlist.html" class="code" title="function DeviceList = getlist(varargin)">getlist</a>(Family); |
---|
99 | 0035 <span class="keyword">return</span> |
---|
100 | 0036 <span class="keyword">end</span> |
---|
101 | 0037 <span class="keyword">if</span> size(ElementList,2) == 2 |
---|
102 | 0038 <span class="comment">% Assume that the input was already a device list</span> |
---|
103 | 0039 Output = ElementList; |
---|
104 | 0040 <span class="keyword">return</span> |
---|
105 | 0041 <span class="keyword">end</span> |
---|
106 | 0042 |
---|
107 | 0043 <span class="comment">%Output = getfamilydata(Family, 'DeviceList', DevList);</span> |
---|
108 | 0044 |
---|
109 | 0045 [FamilyIndex, ACCELERATOR_OBJECT] = <a href="isfamily.html" class="code" title="function [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a>(Family); |
---|
110 | 0046 <span class="keyword">if</span> FamilyIndex |
---|
111 | 0047 DeviceListTotal = ACCELERATOR_OBJECT.DeviceList; |
---|
112 | 0048 ElementListTotal = ACCELERATOR_OBJECT.ElementList; |
---|
113 | 0049 Err = 0; |
---|
114 | 0050 |
---|
115 | 0051 <span class="comment">% Intersect removes duplicate devices so first store index of how to unsort in j_unique</span> |
---|
116 | 0052 ElementListOld = ElementList; |
---|
117 | 0053 [ElementList, i_unique, j_unique] = unique(ElementList); |
---|
118 | 0054 |
---|
119 | 0055 <span class="comment">% Find the indexes in the full device list (reorder and remove duplicates)</span> |
---|
120 | 0056 [ElementList, ii, DeviceIndex] = intersect(ElementList, ElementListTotal); |
---|
121 | 0057 <span class="keyword">if</span> size(ElementList,1) ~= size(ElementListOld,1) |
---|
122 | 0058 <span class="comment">% All devices must exist (duplicate devices ok)</span> |
---|
123 | 0059 [ElementListNotFound, iNotFound] = setdiff(ElementListOld, ElementListTotal); |
---|
124 | 0060 <span class="keyword">if</span> length(iNotFound) > 0 |
---|
125 | 0061 <span class="comment">% Device not found</span> |
---|
126 | 0062 <span class="keyword">for</span> i = 1:length(iNotFound) |
---|
127 | 0063 fprintf(<span class="string">' No devices to get for Family %s(%d)\n'</span>, ACCELERATOR_OBJECT.FamilyName, ElementListNotFound(i)); |
---|
128 | 0064 <span class="keyword">end</span> |
---|
129 | 0065 error(sprintf(<span class="string">'%d Devices not found'</span>, length(iNotFound))); |
---|
130 | 0066 <span class="keyword">end</span> |
---|
131 | 0067 <span class="keyword">end</span> |
---|
132 | 0068 Output = DeviceListTotal(DeviceIndex,:); <span class="comment">% Only data referenced to DeviceList</span> |
---|
133 | 0069 Output = Output(j_unique,:); <span class="comment">% Reorder and add multiple elements back</span> |
---|
134 | 0070 <span class="keyword">else</span> |
---|
135 | 0071 error(sprintf(<span class="string">'%s family not found'</span>, Family)); |
---|
136 | 0072 <span class="keyword">end</span> |
---|
137 | 0073</pre></div> |
---|
138 | <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> |
---|
139 | </body> |
---|
140 | </html> |
---|