source: MML/trunk/machine/SOLEIL/doc_html/machine/Soleil/StorageRing/measchronat.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: 6.8 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 measchronat</title>
6  <meta name="keywords" content="measchronat">
7  <meta name="description" content="function [xix xiz] = measchronat">
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="#">machine</a> &gt; <a href="#">Soleil</a> &gt; <a href="index.html">StorageRing</a> &gt; measchronat.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 machine/Soleil/StorageRing&nbsp;<img alt=">" border="0" src="../../../right.png"></a></td></tr></table>-->
19
20<h1>measchronat
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>function [xix xiz] = measchronat</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>This is a script file. </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">function [xix xiz] = measchronat
31 MEASCHRONAT - Measure natural chromaticity by varyiong dipole fied
32
33  INPUTS
34
35  OUTPUTS
36  1. xix - horizontal natural chromaticity
37  2. xiz - vertical natural chromaticity</pre></div>
38
39<!-- crossreference -->
40<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
41This function calls:
42<ul style="list-style-image:url(../../../matlabicon.gif)">
43<li><a href="getrmn.html" class="code" title="function [RMN, tout, DataTime, ErrorFlag] = getrmn(varargin)">getrmn</a>  GETDCCT - returns the beam current</li></ul>
44This function is called by:
45<ul style="list-style-image:url(../../../matlabicon.gif)">
46</ul>
47<!-- crossreference -->
48
49
50<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
51<div class="fragment"><pre>0001 <span class="comment">%function [xix xiz] = measchronat</span>
520002 <span class="comment">% MEASCHRONAT - Measure natural chromaticity by varyiong dipole fied</span>
530003 <span class="comment">%</span>
540004 <span class="comment">%  INPUTS</span>
550005 <span class="comment">%</span>
560006 <span class="comment">%  OUTPUTS</span>
570007 <span class="comment">%  1. xix - horizontal natural chromaticity</span>
580008 <span class="comment">%  2. xiz - vertical natural chromaticity</span>
590009
600010 <span class="comment">%</span>
610011 <span class="comment">% Written by Laurent S. Nadolski</span>
620012
630013 <span class="comment">% TODO List</span>
640014 <span class="comment">% ajouter fit automatique</span>
650015 <span class="comment">% Regler les contantes de temps, la RMN mais entre 15 et 20 s pour mettre à jour la lecture du champ B</span>
660016
670017 nb = 4;
680018 tune= [];
690019 Idip = [];
700020 Rmn = [];
710021 itot = 1.0; <span class="comment">% total step for dipole in A</span>
720022 istep = -itot/nb; <span class="comment">% stepsize in A</span>
730023
740024 tune_start = gettune;
750025 stepsp(<span class="string">'BEND'</span>,itot);
760026 fprintf(<span class="string">'Dipole current (%f A) is changed by %f\n'</span>,getsp(<span class="string">'BEND'</span>), itot);
770027 pause(40);
780028 Idip(1) = getsp(<span class="string">'BEND'</span>);
790029 <span class="comment">% for ik1 = 1:100,</span>
800030 <span class="comment">%     temp(ik1) = getam('BEND'); pause(0.1)</span>
810031 <span class="comment">% end</span>
820032 <span class="comment">%Idip(1) = mean(temp);</span>
830033 Rmn(1) = <a href="getrmn.html" class="code" title="function [RMN, tout, DataTime, ErrorFlag] = getrmn(varargin)">getrmn</a>;
840034 tune(1,:) = gettune
850035
860036 k1 = 2;
870037 <span class="keyword">for</span> k = nb:-1:-nb+1,   
880038     stepsp(<span class="string">'BEND'</span>,istep);   
890039     pause(30);
900040     Idip(k1) = getsp(<span class="string">'BEND'</span>);
910041 <span class="comment">%     for ik1 = 1:100,</span>
920042 <span class="comment">%         temp(ik1) = getam('BEND'); pause(0.1)</span>
930043 <span class="comment">%     end</span>
940044 <span class="comment">%    Idip(k1) = mean(temp);</span>
950045     fprintf(<span class="string">'Dipole current (%f A) is changed by %f A\n'</span>,Idip(k1), istep);
960046     tune(k1,:) = gettune
970047     Rmn(k1) = <a href="getrmn.html" class="code" title="function [RMN, tout, DataTime, ErrorFlag] = getrmn(varargin)">getrmn</a>;
980048     k1 = k1 + 1;
990049 <span class="keyword">end</span>
1000050
1010051 stepsp(<span class="string">'BEND'</span>,itot);
1020052 fprintf(<span class="string">'Dipole current (%f A) is changed back to nominal value by %f A\n'</span>,getsp(<span class="string">'BEND'</span>), itot);
1030053 pause(40);
1040054
1050055 tune_finish = gettune;
1060056
1070057 fprintf(<span class="string">'Tune variation \n'</span>)
1080058 fprintf(<span class="string">'begin %f %f\n'</span>,tune_start)
1090059 fprintf(<span class="string">'end %f %f\n'</span>,tune_finish)
1100060
1110061 <span class="comment">% BUG should accept a array</span>
1120062 E = [];
1130063
1140064 <span class="keyword">for</span> k = 1:length(Idip),
1150065     E(k) = bend2gev(Idip(k));
1160066 <span class="keyword">end</span>
1170067
1180068 E0 = 2.73913739373611;
1190069 <span class="comment">% E = (E-E0)./E0;</span>
1200070 <span class="comment">% E = E';</span>
1210071 E = (Rmn-Rmn(5))./Rmn(5);
1220072 E = E';
1230073
1240074 <span class="comment">%%</span>
1250075 p1 = polyfit(E,tune(:,1),1)
1260076 p2 = polyfit(E,tune(:,2),1)
1270077
1280078 fprintf(<span class="string">'natural chromaticity xix = %4.1f xiz = %4.1f\n'</span>,p1(1),p2(1));
1290079
1300080 <span class="comment">%%</span>
1310081 figure;
1320082 subplot(2,1,1)
1330083 suptitle(sprintf(<span class="string">'Natural chromaticity xix = %4.1f xiz = %4.1f\n'</span>,p1(1),p2(1)));
1340084 plot(E*100,tune(:,1),<span class="string">'.-'</span>)
1350085 hold on
1360086 plot(E*100,polyval(p1,E), <span class="string">'k'</span>)
1370087
1380088 ylabel(<span class="string">'nux'</span>)
1390089 grid on
1400090 subplot(2,1,2)
1410091 plot(E*100,tune(:,2),<span class="string">'.-'</span>)
1420092 hold on
1430093 plot(E*100,polyval(p2,E), <span class="string">'k'</span>)
1440094 ylabel(<span class="string">'nuz'</span>)
1450095 xlabel(<span class="string">'Energy deviation [%]'</span>);
1460096 grid on
1470097
1480098 xix = p1(1); xiz = p2(1);</pre></div>
149<hr><address>Generated on Mon 21-May-2007 15:35:27 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
150</body>
151</html>
Note: See TracBrowser for help on using the repository browser.