Changeset 28 in MML


Ignore:
Timestamp:
Mar 12, 2014, 3:34:59 PM (10 years ago)
Author:
zhangj
Message:

Add features to set/get the TL Dipoles by the bending angle, while the ring dipoles are still connected to the beam energy in AT. (Maybe this features in TL dipoles need to change back in the future...)

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LOGFILE_thomx.m

    r27 r28  
    177177the names of the 4 first initials as "BEND...".
    178178***************
     179
     180****************
     18105/03/2014
     182
     183Modified "setpvmodel.m" and "getpvmodel.m", now the values of TL ...
     184    dipoles can be modified or read back by the bending angles
     185    with the physics unit [rad], through the functions "setsp()"
     186    or "getsp()". While the dipoles in the storage ring are still
     187    connected to the beam energy as before.
     188***************
     189
  • trunk/at/atphysics/findorbit4.m

    r4 r28  
    7474end
    7575RMATf = linepass(RING,RMATi);
    76 Rf = RMATf(:,5);
     76Rf = RMATf(:,5); %energy
    7777% compute the transverse part of the Jacobian
    7878J4 =  [RMATf(1:4,1:4)-RMATf(1:4,5)*ones(1,4)]/d;
  • trunk/at/simulator/track/linepass.m

    r4 r28  
    2727%     to different REFPTS
    2828%     FOR EXAMPLE:
    29 %     if Rin is 6-by-2 maid of two 6-by-1 column vectors [Rin1, Rin2]
     29%     if Rin is 6-by-2 mad of two 6-by-1 column vectors [Rin1, Rin2]
    3030%     and REFPTS = [N1 N2 N3] so that N1<N2<N3
    3131%     the output is [Rout1(N1) Rout2(N1) Rout1(N2) Rout2(N2) Rout1(N3) Rout2(N3)]
  • trunk/machine/THOMX/StorageRing/Lattices/CDR_017_064_r56_02_sx_Dff_1_cro0_NoDipFF.m

    r5 r28  
     1function varargout = CDR_017_064_r56_02_sx_Dff_1_cro0_NoDipFF 
    12%************************************************
    23%
     
    3940%              NAME   L     U[V]       f[Hz]          h        method
    4041%CAV = rfcavity('CAV' , 0.0 , 0*300.0e+3 , HarmNumber*C0/L0, HarmNumber ,'CavityPass');
    41 CAV = rfcavity('CAV' , 0.0 , 0 , HarmNumber*C0/L0, HarmNumber,'CavityPass');
    42  
     42RF = rfcavity('RF' , 0.0 , 0 , HarmNumber*C0/L0, HarmNumber,'CavityPass');
     43 
     44%!------------------------------------}
     45%! DRIFT                              }
     46%!------------------------------------}
    4347SD0        =drift('SD0',0.1000000E+00, 'DriftPass');
    4448SD1        =drift('SD1',0.1300000E+00, 'DriftPass');
     
    5256SD3S       =drift('SD3S', 0.6000000E-01, 'DriftPass');
    5357SD3S1      =drift('SD3S1', 0.1400000E+00, 'DriftPass');
    54  
     58
     59%!------------------------------------}
     60%! DIPOLE                             }
     61%!------------------------------------}
    5562L = 0.27646;
    5663theta = 0.785398;
     
    6269COE = drift('COE',0.0,'DriftPass');
    6370COS = drift('COS',0.0,'DriftPass');
    64 %DIP = rbend2('DIP', L, theta, thetae, thetas, K, 0.0,...
    65 %              'BndMPoleSymplectic4Pass');
     71BEND = rbend2('BEND', L, theta, thetae, thetas, K, 0.0,...
     72              'BndMPoleSymplectic4Pass');
    6673         
    67 DIP = rbend3('DIP', L, theta, thetae, thetas, K, 0.0,...
    68               edge_effect1,edge_effect2,'BndMPoleSymplecticNew4Pass');
    69          
     74% DIP = rbend3('DIP', L, theta, thetae, thetas, K, 0.0,...
     75%               edge_effect1,edge_effect2,'BndMPoleSymplecticNew4Pass');
     76
     77
     78%!------------------------------------}
     79%! QUADRUPOLE                         }
     80%!------------------------------------}     
    7081 LQP = 0.15; % quadrupole length
    7182 QPassMethod = 'StrMPoleSymplectic4Pass'; % tracking method
     
    7687 QP31=quadrupole('QP31',LQP,-.1192025E+02,QPassMethod);
    7788 QP41=quadrupole('QP41',LQP,0.9056717E+01,QPassMethod);
     89
    7890 
     91%!----------------------------------}
     92%! SEXTUPOLE                        }
     93%!----------------------------------}
    7994LSX = 0.1000000E-05;
    8095SPassMethod = 'StrMPoleSymplectic4Pass';
     
    8499 SX3        =sextupole('SX3', LSX, -.1901670E+07*1, SPassMethod);
    85100 
     101 %% =======================
     102% BPM
     103%========================
     104% horizontal
     105BPMx = marker('BPMx', 'IdentityPass');
     106% vertical
     107BPMz = marker('BPMz', 'IdentityPass');
     108 
     109%% =======================
     110% correctors
     111%=========================
     112%
     113 HCOR = corrector('HCOR',1.0e-6,[0.0, 0],'CorrectorPass');
     114 
     115 VCOR = corrector('VCOR',1.0e-6,[0, 0.0],'CorrectorPass');
    86116
    87 ELIST=[...
    88  SD5        QP1        SD2        QP2        SD31       COE...       
    89  DIP        COS        SD3S1      SX1        SD3S       QP31...     
    90  SD3S       SX3        SD3S1      QP41       SD1S1      SX2...       
    91  SD1S       QP4        SD2        QP3        SD3        COE...       
    92  DIP        COS        SD0        SD0        COE        DIP...       
    93  COS        SD3        QP3        SD2        QP4        SD1S...     
    94  SX2        SD1S1      QP41       SD3S1      SX3        SD3S...     
    95  QP31       SD3S       SX1        SD3S1      COE        DIP...       
    96  COS        SD31       QP2        SD2        QP1        SD5...       
    97  SD5        QP1        SD2        QP2        SD31       COE...       
    98  DIP        COS        SD3S1      SX1        SD3S       QP31...     
    99  SD3S       SX3        SD3S1      QP41       SD1S1      SX2...       
    100  SD1S       QP4        SD2        QP3        SD3        COE...       
    101  DIP        COS        SD0        SD0        COE        DIP...       
    102  COS        SD3        QP3        SD2        QP4        SD1S...     
    103  SX2        SD1S1      QP41       SD3S1      SX3        SD3S...     
    104  QP31       SD3S       SX1        SD3S1      COE        DIP...       
    105  COS        SD31       QP2        SD2        QP1        SD5...       
    106 ];
     117%=====================================
     118% !MARKER                 
     119%=====================================
     120DEBUT =  marker('DEBUT','IdentityPass');
     121FIN   =  marker('FIN','IdentityPass');
     122
     123
     124%!=====================================}
     125%! RING LATTICE                        } 
     126%!=====================================}
     127
     128ELIST=[DEBUT, ...
     129 SD5        BPMx        BPMz      QP1        SD2...
     130 QP2        SD31       COE...       
     131 BEND        COS        SD3S1      SX1        HCOR...
     132 VCOR       SD3S       QP31...     
     133 SD3S       SX3        HCOR       VCOR       SD3S1...
     134 QP41       BPMx       BPMz       SD1S1      SX2...
     135 HCOR       VCOR...
     136 SD1S       QP4        SD2        QP3        SD3...
     137 BPMx       BPMz       COE...       
     138 BEND        COS        SD0        SD0        COE...
     139 BEND...       
     140 COS        SD3        BPMx       BPMz       QP3        SD2        QP4...
     141 SD1S       HCOR       VCOR...     
     142 SX2        SD1S1      BPMx       BPMz       QP41       SD3S1      SX3...
     143 HCOR       VCOR       SD3S...     
     144 QP31       SD3S       HCOR       VCOR       SX1...
     145 SD3S1      COE...
     146 BEND...       
     147 COS        SD31       QP2        SD2        QP1...
     148 BPMx       BPMz       SD5...       
     149 SD5        BPMx       BPMz       QP1        SD2        QP2        SD31...
     150 COE...       
     151 BEND        COS        SD3S1      SX1        HCOR...
     152 VCOR       SD3S...
     153 QP31...     
     154 SD3S       SX3        HCOR       VCOR       SD3S1...
     155 QP41       BPMx       BPMz       SD1S1...
     156 HCOR       VCOR       SX2...       
     157 SD1S       QP4        SD2        QP3        SD3...
     158 BPMx       BPMz       COE...       
     159 BEND        COS        SD0        SD0        COE...
     160 BEND...       
     161 COS        SD3        BPMx       BPMz       QP3        SD2        QP4...
     162 SD1S       HCOR       VCOR...     
     163 SX2        SD1S1      BPMx       BPMz       QP41       SD3S1      SX3...
     164 HCOR       VCOR       SD3S...     
     165 QP31       SD3S       SX1        HCOR       VCOR...
     166 SD3S1      COE...
     167 BEND...       
     168 COS        SD31       QP2        SD2        QP1...
     169 BPMx       BPMz       SD5...       
     170 RF,        FIN];
    107171
    108172buildlat(ELIST);
     
    110174% Set all magnets to same energy
    111175THERING = setcellstruct(THERING,'Energy',1:length(THERING),GLOBVAL.E0);
    112 
    113 
    114176
    115177   
  • trunk/machine/THOMX/StorageRing/Lattices/CDR_017_064_r56_02_sx_Dff_corrSX_BPMIP.m

    r13 r28  
    1818disp(['** Loading THOMX ring lattice ',mfilename]);
    1919
    20 L0 =  16.789703999999997;   % the 6D COD of ThomX ring is very sensitive to the
     20L0 =   16.800115999999992;   % the 6D COD of ThomX ring is very sensitive to the
    2121             %   longitudinal setting, so defind the
    2222             %   value of L0 as the value getting from "getcircumfenrence"!!!
     
    9595 % SX3        = sextupole('SX3', 0.06e-10, -0.1903113E+07*sx_on*0, SPassMethod);
    9696
    97  SX1       = sextupole('SX1', 0.1000000E-05, -0.8375307E+07*1, SPassMethod);
     97 SX1       = sextupole('SX1', 0.1000000E-05, -0.8375307E+07*sx_on, SPassMethod);
    9898 SX2       = sextupole('SX2', 0.1000000E-05,  0.2405303E+07*sx_on, SPassMethod);
    9999 SX3       = sextupole('SX3', 0.1000000E-05, -0.1903113E+07*sx_on, SPassMethod);
  • trunk/machine/THOMX/StorageRing/Lattices/CDR_017_072_r56_02_sx_Dff_corrSX_BPMIP_SEP.m

    r27 r28  
    144144 %%================================
    145145 %   septum and injection kickers
    146  %    Pulsed magnets
    147146 %
     147 %   Pulsed magnets
    148148 %%================================
     149 % 160 mrad --- 170 mrad
    149150 SEP = corrector('SEP', 1.0e-10,[0.0,0.0],'CorrectorPass');
    150151 
    151152 % These two kickers are only connected to TANGO, not connected to AT
     153 % 11 mrad --- 15 mrad
    152154 % injection kicker
    153155 KICKERIN = corrector('KICKERIN', 1.0e-10,[0.0,0.0],'CorrectorPass');
  • trunk/machine/THOMX/StorageRing/setoperationalmode.m

    r25 r28  
    1717%               CDR_017_072_r56_02_sx_Dff_corrSX_BPMIP
    1818%                but with the definitions of septums and inj.&extr. kickers
     19%
     20%
     21% ModeNumber 100 =
     22%               CDR_017_064_r56_02_sx_Dff_1_cro0_NoDipFF   
     23%                without dipole fringe field.
     24%
    1925%
    2026%  See also aoinit, updateatindex, thomxinit, setmmldirectories, lattice_prep
     
    6268
    6369% Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
    64 AD.DeltaRFDisp = 100e-6; % machine unit, 100 Hz; called by measdisp.m
     70% minimum orbit change 14 micro meter.
     71AD.DeltaRFDisp = 100e-6*1e1; % machine unit, 100 Hz; called by measdisp.m
    6572% the mcf of ThomX ring is 1.37e-2, so must have a relative large deltaRF,
    66 % otherwise the change of energy offset is too small
    67 AD.DeltaRFChro = [-100 -50 0 50 100] * 1e-6*1e1; % machine unit; -50*1e2 Hz
     73% otherwise the change of energy offset is too small, and BPMs can't
     74% detect such a small orbit (BPM resolution is about 5 micro meters in ThomX ring).
     75
     76
     77AD.DeltaRFChro = [-100 -50 0 50 100] * 1e-6*1e2; % machine unit; -50*1e2 Hz
    6878
    6979
     
    175185    %AO = local_setmagnetcoefficient(AO, @magnetcoefficients);
    176186    %setao(AO);
    177        
     187 elseif ModeNumber == 100
     188    AD.OperationalMode = '50e-3 GeV, 3.175 1.64';
     189    AD.Energy = 50e-3; % Make sure this is the same as bend2gev at the production lattice!
     190    ModeName = 'CDR_017_064_r56_02_sx_Dff_1_cro0_NoDipFF';
     191    OpsFileExtension = '_CDR_017_064_r56_02_sx_Dff_1_cro0_NoDipFF';
     192
     193    % AT lattice
     194    AD.ATModel = 'CDR_017_064_r56_02_sx_Dff_1_cro0_NoDipFF';
     195    eval(AD.ATModel);  %run model for compiler;
     196
     197    % Golden TUNE is with the TUNE family
     198    AO = getao;
     199    AO.TUNE.Monitor.Golden = [
     200        0.175
     201        0.640
     202        NaN];
     203
     204    % Golden chromaticity is in the AD (Physics units)
     205    AD.Chromaticity.Golden = [0.0; 0.0];
     206
     207    % Status factory
     208    % don't need for ThomX ?????
     209    %local_set_config_mode('normalconfig120'); d
     210    %AO = local_setmagnetcoefficient(AO, @magnetcoefficients);
     211    %setao(AO);
     212               
    178213 else
    179214    error('Operational mode unknown');
  • trunk/machine/THOMX/StorageRing/thomxringgui.m

    r26 r28  
    2424% Edit the above text to modify the response to help operationgui
    2525
    26 % Last Modified by GUIDE v2.5 21-Feb-2014 12:33:51
     26% Last Modified by GUIDE v2.5 25-Feb-2014 14:59:25
    2727
    2828% Begin initialization code - DO NOT EDIT
     
    111111measbeta;
    112112
    113 % --- Executes on button press in pushbutton_FBNU.
    114 function pushbutton_FBNU_Callback(hObject, eventdata, handles)
    115 % hObject    handle to pushbutton_FBNU (see GCBO)
    116 % eventdata  reserved - to be defined in a future version of MATLAB
    117 % handles    structure with handles and user data (see GUIDATA)
    118 
    119 % to be updated for ThomX
    120 tuneFBgui;
     113% --- Executes on button press in pushbutton_meas.
     114function pushbutton_meas_Callback(hObject, eventdata, handles)
     115% hObject    handle to pushbutton_meas (see GCBO)
     116% eventdata  reserved - to be defined in a future version of MATLAB
     117% handles    structure with handles and user data (see GUIDATA)
     118
     119% to be updated for ThomX
     120measmcf;
    121121
    122122% --- Executes on button press in pushbutton_setoperationalmode.
     
    355355
    356356
    357 % --- Executes on button press in meas_mcf.
    358 function meas_mcf_Callback(hObject, eventdata, handles)
    359 % hObject    handle to meas_mcf (see GCBO)
    360 % eventdata  reserved - to be defined in a future version of MATLAB
    361 % handles    structure with handles and user data (see GUIDATA)
    362 
    363 measmcf;
     357
    364358
    365359
  • trunk/machine/THOMX/readme

    r27 r28  
    4848
    4949**********************************************
     50---- 05/03/2014
     51       In AT model, the TL dipoles are set up and read back
     52       by the physics units [rad].
     53       While the storage ring dipoles are set up and read
     54       back by the beam energy through "bend2gev.m" & "gev2bend.m".
     55     
     56      The set up and read back of the TL dipoles needs to be
     57      checked in the connections through Tango.
     58 
    5059
     60----    Need to check the basic values setting using MML
     61        through TANGO:
     62 
     63         setsp(), getsp()
    5164
     65         dipole, quadrupole, sextupole, kicker, BPM, etc.
    5266
     67----   Set element properties using CHANEL names through TANGO.
  • trunk/mml/at/getpvmodel.m

    r26 r28  
    5656% add in bpm and corrector other names (machine dependent?)
    5757%
    58 % Need to customized for ThomX in the future...(with the real devices (mangets...) parameters)
    59 %  by Jianfeng Zhang @ LAL,
    60 % 07/10/2013
    6158%
     59% Jianfeng Zhang @ LAL, 07/10/2013
     60%   Need to customized for ThomX in the future...(with the real devices (mangets...),
     61%    bend2gev.m, gev2bend.m, k2amp.m, amp2k,m, etc. and other parameters)
     62%
     63% Jianfeng Zhang @ LAL, 05/03/2014
     64%    Return the TL dipole bending angles, while still to return
     65%    the corresponding energy of the dipoles in storage ring.
     66%
     67%
     68%%
     69
    6270
    6371global THERING THERINGCELL
     
    802810        elseif strcmpi(AT.ATType, 'BEND')
    803811            % BEND
    804             for i = 1:length(ATIndexList)
    805                 AM(i,1) = THERING{ATIndexList(i)}.BendingAngle;
     812           
     813            % return the TL bending angle while energy in storage ring
     814            %  by Jianfeng Zhang @ LAL, 05/03/2014
     815            machinetype = getfamilydata('SubMachine');
     816           
     817            if(strcmp(machinetype,'TL'))
     818               for i = 1:length(ATIndexList)
     819                 AM(i,1) = THERING{ATIndexList(i)}.BendingAngle;
     820               end
     821               
     822               UnitsFlag = 'Physics';
     823               fprintf('The machine type is: %s. \nThe bending angles are returned in physics unit [rad]', machinetype);
     824            else
    806825                % Modif: Laurent to be consistent, has to return an energy
     826                for i = 1:length(ATIndexList)
    807827                 AM(i,1) = getenergymodel;
     828                end
    808829            end
    809830
     
    9921013% Change to hardware units if requested %
    9931014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     1015
     1016% only return the bending angle [rad] for the TL dipoles
     1017   
    9941018if strcmpi(UnitsFlag, 'Hardware')
    9951019    if isfamily(Family, Field)
  • trunk/mml/at/plotcod_alex.m

    r4 r28  
    3333orbit = findorbit4(RING,DP,1:length(RING)+1);
    3434%orbit = findorbit6(RING,1:length(RING)+1);
    35 
     35subplot(2,1,1);
    3636plot(localspos,orbit(1,:)*1e3,'.-r');
    3737title('Closed Orbit Distortion')
    38 hold on
     38%hold on
     39subplot(2,1,2)
    3940plot(localspos,orbit(3,:)*1e3,'.-b');
    4041hold off
     
    4445axis(A);
    4546
    46 legend('Horizontal','Vertical');
     47%legend('Horizontal','Vertical');
    4748xlabel('s - position [m]');
    4849ylabel('orbit [mm]');
  • trunk/mml/at/setpvmodel.m

    r25 r28  
    4444% Roll commented for correctors
    4545% Add new family names for BPM and correctors (machine dependent?)
    46 
     46%
     47%
     48%  Jianfeng Zhang @ LAL, 05/03/2014
     49%    Set the TL dipoles by the bending angle in the AT simulator [rad],
     50%    while still set the corresponding beam energy of the storage ring
     51%    dipoles.   
     52%
     53%
     54%
     55
     56%%
    4757ErrorFlag = 0;
    4858
     
    603613                return
    604614            end
    605 
     615           
     616            machinetype = getfamilydata('SubMachine');
     617
     618            % set the TL dipoles by the bending angle in the AT simulator
     619            %  by Jianfeng Zhang @ LAL, 05/03/2014
     620            if(strcmp(machinetype,'TL'))
     621                fprintf('The machine type is: %s. \nThe bending angles will be set in physics unit: [rad]', machinetype);
     622                for i = 1:size(NewSP,1)
     623                THERING{ATIndexList(i)}.BendingAngle = NewSP(i);
     624                end
     625           
     626            % keep to set the ring dipoles by the beam energy     
     627            else
    606628            % Get the energy of the model
    607629            GeVPresent = getenergy('Simulator');
     
    639661           
    640662            setmachineconfig(SP, 'Hardware', 'Simulator');
     663           
     664            end
    641665           
    642666        elseif strcmpi(AT.ATType, 'Roll')
Note: See TracChangeset for help on using the changeset viewer.