source: MML/trunk/mml/doc_html/mml/elem2dev.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: 12.5 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 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 &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; elem2dev.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>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 &quot;Device&quot; 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 &quot;Element&quot; 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>
55This 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>
58This 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>
660002 <span class="comment">%ELEM2DEV - Converts a device list to an element list</span>
670003 <span class="comment">%  [Sector Device#] = elem2dev(Family, Element#)</span>
680004 <span class="comment">%</span>
690005 <span class="comment">%  This function convects between the two methods of representing</span>
700006 <span class="comment">%  the same device in the ring.  The &quot;Device&quot; method is a two column</span>
710007 <span class="comment">%  matrix with the first being sector number and the seconds being</span>
720008 <span class="comment">%  the device number in the sector.  The &quot;Element&quot; method is a one column</span>
730009 <span class="comment">%  matrix with each entry being the element number starting at sector 1.</span>
740010 <span class="comment">%</span>
750011 <span class="comment">%  The following are equivalent devices for VCMs at the ALS:</span>
760012 <span class="comment">%                     | 1  2 |                    |  2 |</span>
770013 <span class="comment">%                     | 1  3 |                    |  3 |</span>
780014 <span class="comment">%  [Sector Device#] = | 2  1 |    [ElementList] = |  9 |</span>
790015 <span class="comment">%                     | 2  2 |                    | 10 |</span>
800016 <span class="comment">%                     | 3  4 |                    | 20 |</span>
810017 <span class="comment">%</span>
820018 <span class="comment">%  NOTES</span>
830019 <span class="comment">%  1. If ElementList is empty, the entire family list will be returned.</span>
840020 <span class="comment">%  2. If the device is not found, then an error will occur.</span>
850021 <span class="comment">%  3. If the Family is not found, then empty, [], is returned.</span>
860022 <span class="comment">%</span>
870023 <span class="comment">%  Written by Greg Portmann</span>
880024
890025
900026 <span class="keyword">if</span> nargin == 0
910027     error(<span class="string">'One input required.'</span>);
920028 <span class="keyword">end</span>
930029 <span class="keyword">if</span> nargin == 1
940030     Output = <a href="getlist.html" class="code" title="function DeviceList = getlist(varargin)">getlist</a>(Family);
950031     <span class="keyword">return</span>
960032 <span class="keyword">end</span>
970033 <span class="keyword">if</span> isempty(ElementList)
980034     Output = <a href="getlist.html" class="code" title="function DeviceList = getlist(varargin)">getlist</a>(Family);
990035     <span class="keyword">return</span>
1000036 <span class="keyword">end</span>
1010037 <span class="keyword">if</span> size(ElementList,2) == 2
1020038     <span class="comment">% Assume that the input was already a device list</span>
1030039     Output = ElementList;
1040040     <span class="keyword">return</span>
1050041 <span class="keyword">end</span>
1060042
1070043 <span class="comment">%Output = getfamilydata(Family, 'DeviceList', DevList);</span>
1080044
1090045 [FamilyIndex, ACCELERATOR_OBJECT] = <a href="isfamily.html" class="code" title="function  [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a>(Family);
1100046 <span class="keyword">if</span> FamilyIndex   
1110047     DeviceListTotal  = ACCELERATOR_OBJECT.DeviceList;
1120048     ElementListTotal = ACCELERATOR_OBJECT.ElementList;
1130049     Err = 0;
1140050     
1150051     <span class="comment">% Intersect removes duplicate devices so first store index of how to unsort in j_unique</span>
1160052     ElementListOld = ElementList;
1170053     [ElementList, i_unique, j_unique] = unique(ElementList);       
1180054     
1190055     <span class="comment">% Find the indexes in the full device list (reorder and remove duplicates)</span>
1200056     [ElementList, ii, DeviceIndex] = intersect(ElementList, ElementListTotal);
1210057     <span class="keyword">if</span> size(ElementList,1) ~= size(ElementListOld,1)
1220058         <span class="comment">% All devices must exist (duplicate devices ok)</span>
1230059         [ElementListNotFound, iNotFound] = setdiff(ElementListOld, ElementListTotal);
1240060         <span class="keyword">if</span> length(iNotFound) &gt; 0
1250061             <span class="comment">% Device not found</span>
1260062             <span class="keyword">for</span> i = 1:length(iNotFound)
1270063                 fprintf(<span class="string">'   No devices to get for Family %s(%d)\n'</span>, ACCELERATOR_OBJECT.FamilyName, ElementListNotFound(i));
1280064             <span class="keyword">end</span>
1290065             error(sprintf(<span class="string">'%d Devices not found'</span>, length(iNotFound)));
1300066         <span class="keyword">end</span>
1310067     <span class="keyword">end</span>
1320068     Output = DeviceListTotal(DeviceIndex,:);   <span class="comment">% Only data referenced to DeviceList</span>
1330069     Output = Output(j_unique,:);               <span class="comment">% Reorder and add multiple elements back</span>
1340070 <span class="keyword">else</span>
1350071     error(sprintf(<span class="string">'%s family not found'</span>, Family));
1360072 <span class="keyword">end</span>
1370073</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> &copy; 2003</address>
139</body>
140</html>
Note: See TracBrowser for help on using the repository browser.