source: MML/trunk/mml/doc_html/mml/family2dev.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: 22.2 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 family2dev</title>
6  <meta name="keywords" content="family2dev">
7  <meta name="description" content="FAMILY2DEV - Return the device list for a family">
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; family2dev.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>family2dev
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>FAMILY2DEV - Return the device list for a family</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 DeviceList = family2dev(Family, varargin); </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">FAMILY2DEV - Return the device list for a family
31  DeviceList = family2dev(FamilyName, StatusFlag, PowerSupplyFlag)
32  DeviceList = family2dev(FamilyName, Field, StatusFlag, PowerSupplyFlag)
33
34  INPUTS
35  1. Family - Family name (ex., 'BEND', 'QFA', 'SF', 'SD', 'HCM', 'VCM', etc.)
36              Data Structure (only the FamilyName field is used)
37              Accelerator Object (only the FamilyName field is used)
38              Cell Array
39  2. Field - Option field input only effects the PowerSupplyFlag
40  3. StatusFlag - 0 return all devices
41                  1 return only devices with good status {Default}
42
43  4. PowerSupplyFlag - 0 return all devices {Default}
44                       1 return only unique channel names (like, power supplies for a magnet)
45
46  OUTPUTS
47  1. DeviceList - Device list corresponding to the Family
48                  Empty if not found
49
50  See Also dev2family, <a href="family2common.html" class="code" title="function [CommonNames, ErrorFlag] = family2common(Family, DeviceList)">family2common</a>, <a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a>, <a href="family2handle.html" class="code" title="function [Handles, ErrorFlag] = family2handle(Family, Field, DeviceList);">family2handle</a>
51          <a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a>, <a href="family2tol.html" class="code" title="function [Data, ErrorFlag] = family2tol(varargin)">family2tol</a>, <a href="family2units.html" class="code" title="function [Units, UnitsString] = family2units(varargin)">family2units</a>, family2tango</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="family2channel.html" class="code" title="function [ChannelNames, ErrorFlag] = family2channel(varargin);">family2channel</a>        FAMILY2CHANNEL - Converts the family name to a channel name</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="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>     GETFAMILYDATA - Gets data associated with the accelerator control</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="builddevlist.html" class="code" title="function [DeviceList, Index] = builddevlist(Family, Elem)">builddevlist</a>       BUILDDEVLIST - Make a full device list from devices in one sector</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="family2channel.html" class="code" title="function [ChannelNames, ErrorFlag] = family2channel(varargin);">family2channel</a>   FAMILY2CHANNEL - Converts the family name to a channel name</li><li><a href="family2common.html" class="code" title="function [CommonNames, ErrorFlag] = family2common(Family, DeviceList)">family2common</a>   FAMILY2COMMON - Convert a family name, device list to a common name list</li><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="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a>      FAMILY2DEV - Return the device list for a family</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="findrf1.html" class="code" title="function [DeltaRF, RFnew, frf] = findrf1(DeltaRF, BPMFamily, BPMList, FileName)">findrf1</a>       FINDRF1 - Finds the RF frequency that minimizes the horizonal dispersion</li><li><a href="getbpm.html" class="code" title="function [BPM1, BPM2, FileName]=getbpm(varargin);">getbpm</a>        GETBPM - Returns the horizontal and vertical orbit</li><li><a href="getbpmresp.html" class="code" title="function [S, FileName] = getbpmresp(varargin)">getbpmresp</a>  GETBPMRESP - Returns the BPM response matrix in the horizontal and vertical planes</li><li><a href="getdisp.html" class="code" title="function [Data, FileName] = getdisp(varargin)">getdisp</a>        GETDISP - Returns the dispersion for a family (from file)</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="getlist.html" class="code" title="function DeviceList = getlist(varargin)">getlist</a>      GETLIST - Returns Device List for a Family</li><li><a href="getnumberofsectors.html" class="code" title="function N = getnumberofsectors">getnumberofsectors</a>        GETNUMBEROFSECTORS - Number of sectors in the lattice</li><li><a href="getphysdata.html" class="code" title="function [Data, iNotFound] = getphysdata(Family, Field, DeviceList)">getphysdata</a>       GETPHYSDATA - Gets physics data</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="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="getspos.html" class="code" title="function S = getspos(Family, DeviceList)">getspos</a>   GETSPOS - Returns the longitudinal position in meters</li><li><a href="hw2physics.html" class="code" title="function S = hw2physics(Family, Field, value, DeviceList, Energy)">hw2physics</a>   HW2PHYSICS - Converts from 'Hardware' units to 'Physics' units</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="makebump.html" class="code" title="function OCS = makebump(varargin)">makebump</a>        MAKEBUMP - Creates and orbit correction structure (OCS) usable by setorbit</li><li><a href="measbpmresp.html" class="code" title="function [Rmat, OutputFileName] = measbpmresp(varargin)">measbpmresp</a>      MEASBPMRESP - Measures the BPM response matrix in the horizontal and vertical planes</li><li><a href="measbpmresplinearity.html" class="code" title="function measbpmresplinearity(CMFamily, mm, CMDeviceList, XAxisFlag)">measbpmresplinearity</a>     MEASBPMRESPLINEARITY - Compute BPMlinearity</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="physics2hw.html" class="code" title="function S = physics2hw(Family, Field, value, DeviceList, Energy)">physics2hw</a>       PHYSICS2HW - Converts from 'Physics' units to 'Hardware' units</li><li><a href="plotgoldenorbit.html" class="code" title="function plotgoldenorbit(varargin)">plotgoldenorbit</a>       PLOTGOLDENORBIT - Plots the golden orbit</li><li><a href="plotoffsetorbit.html" class="code" title="function plotoffsetorbit(varargin)">plotoffsetorbit</a>     PLOTOFFSETORBIT - Plots the offset orbit</li><li><a href="plotorbit.html" class="code" title="function plotorbit(varargin)">plotorbit</a>       PLOTORBIT - Plot the present orbit w.r.t. the golden or offset orbit</li><li><a href="quad2bpm.html" class="code" title="function [BPMFamilyOutput, BPMDevOutput, DeltaSpos, PhaseAdvance] = quad2bpm(QUADFamily, QUADDev, LocationFlag)">quad2bpm</a>  QUAD2BPM - Returns the nearest BPM to the specified quadrupole</li><li><a href="quadcenterinit.html" class="code" title="function QMS = quadcenterinit(QuadFamily, QuadDev, QuadPlane)">quadcenterinit</a>      QMS = quadcenterinit(Family, Device, QuadPlane)</li><li><a href="quadplotall.html" class="code" title="function [Xnew, Ynew, BPMxFamily, QUADxFamily, BPMyFamily, QUADyFamily, DateMatX, DateMatY] = quadplotall(DirName, PlotFlag)">quadplotall</a>    QUADPLOTALL - Collect the date from a quadrupole center run.</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="scanorbit.html" class="code" title="function scanorbit(Family, DeviceList1, DeviceList2)">scanorbit</a>       SCANORBIT - Scans 2 correctors 90 degrees out of phase</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="setorbit.html" class="code" title="function [OCS, OCS0, V, S, ErrorFlag] = setorbit(varargin)">setorbit</a>      SETORBIT - Orbit correction function</li><li><a href="setorbitbump.html" class="code" title="function [OCS, OCS0, V, S, ErrorFlag] = setorbitbump(varargin)">setorbitbump</a>   SETORBITBUMP - Local bump program (uses setorbit)</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><li><a href="sext2bpm.html" class="code" title="function [BPMFamilyOutput, BPMDevOutput, DeltaSpos] = sext2bpm(SEXTFamily, SEXTDev)">sext2bpm</a>     SEXT2BPM - Returns the nearest BPM to the specified sextupole</li><li><a href="showmachinedata.html" class="code" title="function showmachinedata(families)">showmachinedata</a>        SHOWMACHINEDATA - Display setpoints and readbacks for families in AcceleratorObjects</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 DeviceList = family2dev(Family, varargin);</a>
660002 <span class="comment">%FAMILY2DEV - Return the device list for a family</span>
670003 <span class="comment">%  DeviceList = family2dev(FamilyName, StatusFlag, PowerSupplyFlag)</span>
680004 <span class="comment">%  DeviceList = family2dev(FamilyName, Field, StatusFlag, PowerSupplyFlag)</span>
690005 <span class="comment">%</span>
700006 <span class="comment">%  INPUTS</span>
710007 <span class="comment">%  1. Family - Family name (ex., 'BEND', 'QFA', 'SF', 'SD', 'HCM', 'VCM', etc.)</span>
720008 <span class="comment">%              Data Structure (only the FamilyName field is used)</span>
730009 <span class="comment">%              Accelerator Object (only the FamilyName field is used)</span>
740010 <span class="comment">%              Cell Array</span>
750011 <span class="comment">%  2. Field - Option field input only effects the PowerSupplyFlag</span>
760012 <span class="comment">%  3. StatusFlag - 0 return all devices</span>
770013 <span class="comment">%                  1 return only devices with good status {Default}</span>
780014 <span class="comment">%</span>
790015 <span class="comment">%  4. PowerSupplyFlag - 0 return all devices {Default}</span>
800016 <span class="comment">%                       1 return only unique channel names (like, power supplies for a magnet)</span>
810017 <span class="comment">%</span>
820018 <span class="comment">%  OUTPUTS</span>
830019 <span class="comment">%  1. DeviceList - Device list corresponding to the Family</span>
840020 <span class="comment">%                  Empty if not found</span>
850021 <span class="comment">%</span>
860022 <span class="comment">%  See Also dev2family, family2common, family2dev, family2handle</span>
870023 <span class="comment">%          family2status, family2tol, family2units, family2tango</span>
880024
890025 <span class="comment">%</span>
900026 <span class="comment">%  Written by Gregory J. Portmann</span>
910027
920028 <span class="keyword">if</span> nargin == 0
930029     error(<span class="string">'Must have at least one input.'</span>);
940030 <span class="keyword">end</span>
950031
960032
970033 <span class="comment">% Look for a field input</span>
980034 Field = <span class="string">''</span>;
990035 <span class="keyword">if</span> length(varargin) &gt;= 1
1000036     <span class="keyword">if</span> ischar(varargin{1})
1010037         Field = varargin{1};
1020038         varargin(1) = [];
1030039     <span class="keyword">end</span>
1040040 <span class="keyword">end</span>
1050041
1060042
1070043 <span class="comment">% StatusFlag</span>
1080044 <span class="keyword">if</span> length(varargin) &gt;= 1
1090045     StatusFlag = varargin{1};
1100046 <span class="keyword">else</span>
1110047     <span class="comment">% This choice changes the default behavior for the entire middle layer !!!!</span>
1120048     StatusFlag = 1;  <span class="comment">% Only return good status devices</span>
1130049 <span class="keyword">end</span>
1140050
1150051
1160052 <span class="comment">% PowerSupplyFlag</span>
1170053 <span class="keyword">if</span> length(varargin) &gt;= 2
1180054     PowerSupplyFlag = varargin{2};
1190055 <span class="keyword">else</span>
1200056     PowerSupplyFlag = 0;
1210057 <span class="keyword">end</span>
1220058
1230059
1240060 <span class="comment">%%%%%%%%%%%%%%%%%%%%%</span>
1250061 <span class="comment">% Cell Array Inputs %</span>
1260062 <span class="comment">%%%%%%%%%%%%%%%%%%%%%</span>
1270063 <span class="keyword">if</span> iscell(Family)
1280064     <span class="keyword">for</span> i = 1:length(Family)
1290065         <span class="keyword">if</span> iscell(StatusFlag) &amp; iscell(PowerSupplyFlag)
1300066             DeviceList{i} = <a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a>(Family{i}, StatusFlag{i}, PowerSupplyFlag{i});
1310067         <span class="keyword">elseif</span> iscell(StatusFlag)
1320068             DeviceList{i} = <a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a>(Family{i}, StatusFlag{i}, PowerSupplyFlag);
1330069         <span class="keyword">elseif</span> iscell(PowerSupplyFlag)
1340070             DeviceList{i} = <a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a>(Family{i}, StatusFlag, PowerSupplyFlag{i});
1350071         <span class="keyword">else</span>
1360072             DeviceList{i} = <a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a>(Family{i}, StatusFlag, PowerSupplyFlag);
1370073         <span class="keyword">end</span>
1380074     <span class="keyword">end</span>
1390075     <span class="keyword">return</span>
1400076 <span class="keyword">end</span>
1410077
1420078
1430079 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
1440080 <span class="comment">% Family or data structure inputs beyond this point %</span>
1450081 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
1460082 <span class="keyword">if</span> isstruct(Family)
1470083     <span class="comment">% Structures can be an accelerator object or a data structure (as returned by getpv)</span>
1480084     <span class="keyword">if</span> isfield(Family, <span class="string">'FamilyName'</span>)
1490085         <span class="comment">% Data structure</span>
1500086         Family = Family.FamilyName;   
1510087     <span class="keyword">else</span>
1520088         error(<span class="string">'Family input of unknown type'</span>);
1530089     <span class="keyword">end</span>
1540090 <span class="keyword">end</span>
1550091
1560092
1570093 [DeviceList, ErrorFlag] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family, <span class="string">'DeviceList'</span>);
1580094 <span class="keyword">if</span> isempty(DeviceList)
1590095     error(sprintf(<span class="string">'%s family not found'</span>, Family));
1600096 <span class="keyword">end</span>
1610097
1620098
1630099 <span class="keyword">if</span> StatusFlag
1640100     Status = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family, <span class="string">'Status'</span>, DeviceList);
1650101     <span class="keyword">if</span> isempty(Status)
1660102         fprintf(<span class="string">'   WARNING:  Status field not in the AO, hence ignored.\n'</span>);
1670103     <span class="keyword">else</span>
1680104         DeviceList = DeviceList(find(Status),:);
1690105     <span class="keyword">end</span>
1700106 <span class="keyword">end</span>
1710107
1720108
1730109 <span class="keyword">if</span> PowerSupplyFlag
1740110     <span class="comment">% There can be multiple channel names due to &quot;ganged&quot; power supplies</span>
1750111     <span class="keyword">if</span> isempty(Field)
1760112         ChannelNames0 = <a href="family2channel.html" class="code" title="function [ChannelNames, ErrorFlag] = family2channel(varargin);">family2channel</a>(Family, DeviceList);
1770113     <span class="keyword">else</span>
1780114         ChannelNames0 = <a href="family2channel.html" class="code" title="function [ChannelNames, ErrorFlag] = family2channel(varargin);">family2channel</a>(Family, Field, DeviceList);
1790115     <span class="keyword">end</span>
1800116     [ChannelNames, ii, jj] = unique(ChannelNames0, <span class="string">'rows'</span>);
1810117
1820118     <span class="keyword">if</span> length(ii) ~= size(ChannelNames0,1)
1830119         <span class="comment">% Remove ' ' (' ' should always be the first row)</span>
1840120         <span class="keyword">if</span> isempty(deblank(ChannelNames(1,:)))
1850121             ii(1) = [];
1860122             jj(jj==1) = [];
1870123             jj = jj - 1;
1880124         <span class="keyword">end</span>
1890125
1900126         ChannelNames = ChannelNames0(ii,:);
1910127
1920128         <span class="comment">% Unique does a sort and keeps the last device.</span>
1930129         
1940130         <span class="comment">% Remove the sort</span>
1950131         jjtmp = jj;
1960132         <span class="keyword">for</span> i = 1:max(jj)
1970133             iDev(i) = jjtmp(1);
1980134             jjtmp(jjtmp==jjtmp(1)) = [];
1990135         <span class="keyword">end</span>
2000136         ChannelNames = ChannelNames(iDev,:);
2010137         
2020138         <span class="comment">% Find the first device with that name</span>
2030139         i = findrowindex(ChannelNames, ChannelNames0);
2040140         DeviceList = DeviceList(i,:);
2050141     <span class="keyword">else</span>
2060142         <span class="comment">% Remove ' ' (' ' should always be the first row)</span>
2070143         <span class="keyword">if</span> isempty(deblank(ChannelNames(1,:)))
2080144             iBlank = find(jj==1);
2090145             DeviceList(iBlank,:) = [];
2100146         <span class="keyword">end</span>
2110147     <span class="keyword">end</span>
2120148 <span class="keyword">end</span>
2130149
2140150
2150151 <span class="comment">% if nargin &gt;= 2</span>
2160152 <span class="comment">%     if varargin{1}</span>
2170153 <span class="comment">%         Status = getfamilydata(Family, 'Status', DeviceList);</span>
2180154 <span class="comment">%         if isempty(Status)</span>
2190155 <span class="comment">%             fprintf('   WARNING:  Status field not in the AO, hence ignored.\n');</span>
2200156 <span class="comment">%         else</span>
2210157 <span class="comment">%             DeviceList = DeviceList(find(Status),:);</span>
2220158 <span class="comment">%         end</span>
2230159 <span class="comment">%     end</span>
2240160 <span class="comment">% end</span>
2250161
2260162</pre></div>
227<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>
228</body>
229</html>
Note: See TracBrowser for help on using the repository browser.