[4] | 1 | soleilinit |
---|
| 2 | getx |
---|
| 3 | plot(getx) |
---|
| 4 | family2dev('BPMx') |
---|
| 5 | family2tango('BPMx') |
---|
| 6 | help getx |
---|
| 7 | help family2tango |
---|
| 8 | doc tango |
---|
| 9 | tango_command_inout('ANS-C08/EI/M-HU80.2_CHAN1', 'State') |
---|
| 10 | tango_error |
---|
| 11 | dev = 'ANS-C08/EI/M-HU80.2_CHAN1'; |
---|
| 12 | class(dev) |
---|
| 13 | a=2 |
---|
| 14 | class(a) |
---|
| 15 | tango_state(dev) |
---|
| 16 | tango_status(dev) |
---|
| 17 | devM='ans-c08/ei/m-hu80.2_motorscontrol' |
---|
| 18 | tango_command_inout('ANS-C08/EI/M-HU80.2_CHAN1', 'State') |
---|
| 19 | tango_command_inout(devM, 'State') |
---|
| 20 | tango_command_inout2(devM, 'State') |
---|
| 21 | tango_command_inout(devM, 'State4') |
---|
| 22 | tango_command_inout2(devM, 'State4') |
---|
| 23 | tango_command_inout2(devM, 'ON') |
---|
| 24 | tango_command_inout2(devM, 'On') |
---|
| 25 | tango_command_inout2(devM, 'Status') |
---|
| 26 | tango_command_inout2(devM, 'State') |
---|
| 27 | pp = tango_command_inout2(devM, 'State') |
---|
| 28 | tango_command_inout2(devM, 'State') |
---|
| 29 | print(ans) |
---|
| 30 | printf('%s\n', ans) |
---|
| 31 | fprintf('%s\n', ans) |
---|
| 32 | ans |
---|
| 33 | a=2 |
---|
| 34 | ans |
---|
| 35 | 2 |
---|
| 36 | ans |
---|
| 37 | tango_read_attribute2(devM, 'encoder1Position') |
---|
| 38 | a = tango_read_attribute2(devM, 'encoder1Position') |
---|
| 39 | a |
---|
| 40 | a.value |
---|
| 41 | datestr(a.time) |
---|
| 42 | readattribute([devM, 'encoder1Position']) |
---|
| 43 | [devM, 'encoder1Position']) |
---|
| 44 | [devM, 'encoder1Position'] |
---|
| 45 | [devM, '/encoder1Position'] |
---|
| 46 | readattribute([devM, '/encoder1Position']) |
---|
| 47 | [a z ] = readattribute([devM, '/encoder1Position']) |
---|
| 48 | help readattribute |
---|
| 49 | [a z t] = readattribute([devM, '/encoder1Position']) |
---|
| 50 | edit readattribute.m |
---|
| 51 | datestr(t) |
---|
| 52 | [a z t] = readattribute([devM, '/encoder2Position']) |
---|
| 53 | [a z t] = readattribute([devM, '/encoder3Position']) |
---|
| 54 | [a z t] = readattribute([devM, '/encoder4Position']) |
---|
| 55 | [a z t] = readattribute([devM, '/encoder5Position']) |
---|
| 56 | [a z t] = readattribute([devM, '/encoder6Position']) |
---|
| 57 | tango_command_inout2(devM, 'GotoGap', 2400000) |
---|
| 58 | tango_command_inout2(devM, 'GotoGap', int32(2400000)) |
---|
| 59 | [a z t] = readattribute([devM, '/encoder2Position']) |
---|
| 60 | tango_command_inout2(devM, 'Init') |
---|
| 61 | tango_command_inout2(devM, 'State') |
---|
| 62 | tango_command_inout2(devM, 'On') |
---|
| 63 | tango_command_inout2(devM, 'ResetError') |
---|
| 64 | tango_command_inout2(devM, 'Reset') |
---|
| 65 | tango_command_inout2(devM, 'GotoGap', int32(2100000)) |
---|
| 66 | tango_command_inout2(devM, 'GotoPhase', int32(50000), int32(50000)) |
---|
| 67 | tango_command_inout2(devM, 'GotoPhase', {int32(50000), int32(50000)}) |
---|
| 68 | tango_command_inout2(devM, 'GotoPhase', [int32(50000), int32(50000)]) |
---|
| 69 | tango_command_inout2(devM, 'Init') |
---|
| 70 | tango_command_inout2(devM, 'GotoPhase', [int32(0), int32(0)]) |
---|
| 71 | tango_command_inout2(devM, 'GotoPhase', [int32(100000), int32(-100000)]) |
---|
| 72 | tango_command_inout2(devM, 'GotoPhase', [int32(0), int32(0)]) |
---|
| 73 | tango_command_inout2(devM, 'GotoGap', int32(2500000)) |
---|
| 74 | |
---|
| 75 | getx |
---|
| 76 | getz |
---|
| 77 | getam('BPMx') |
---|
| 78 | getam('BPMx',[1 1]) |
---|
| 79 | getam('BPMx',[1 1; 1 2]) |
---|
| 80 | getam('BPMx',[5 1; 5 2]) |
---|
| 81 | family2tangodev('BPMx',[5 1; 5 2]) |
---|
| 82 | family2dev('BPMx') |
---|
| 83 | family2status('BPMx') |
---|
| 84 | modelbeta |
---|
| 85 | solorbit |
---|
| 86 | getx |
---|
| 87 | X = getx |
---|
| 88 | I=getdcct |
---|
| 89 | |
---|
| 90 | /home/matlabML/mmlcontrol/Ringspecific/insertions |
---|
| 91 | |
---|
| 92 | /home/matlabML/measdata/Ringdata/insertions/HU80_TEMPO/ |
---|
| 93 | |
---|
| 94 | % H orbit |
---|
| 95 | EI.X = getx; |
---|
| 96 | % V orbit |
---|
| 97 | EI.Z = getz; |
---|
| 98 | % encoder #2 |
---|
| 99 | EI.encoder2= readattribute([devM, '/encoder2Position']); |
---|
| 100 | % stored current |
---|
| 101 | EI.current = getdcct; |
---|
| 102 | % tunes |
---|
| 103 | EI.tune = gettune; |
---|
| 104 | |
---|
| 105 | % measure dispersion functions |
---|
| 106 | [dx dz] = measdisp('Physics'); |
---|
| 107 | |
---|
| 108 | EI.dx = dx; |
---|
| 109 | EI.dz = dz; |
---|
| 110 | |
---|
| 111 | EI.date = datestr(now); % convert date to string |
---|
| 112 | |
---|
| 113 | pause(1); % 1 second pause |
---|
| 114 | |
---|
| 115 | % measure chromaticities |
---|
| 116 | EI.ksi = measchro('Physics'); |
---|
| 117 | |
---|
| 118 | %%%%%%%%%%%%%% ARchiving |
---|
| 119 | |
---|
| 120 | % If the filename contains a directory then make sure it exists |
---|
| 121 | Filename = 'exemple4Oleg'; |
---|
| 122 | |
---|
| 123 | FileName = appendtimestamp('G20_P0'); |
---|
| 124 | DirectoryName = getfamilydata('Directory','HU80_TEMPO'); |
---|
| 125 | DirStart = pwd; |
---|
| 126 | [DirectoryName, ErrorFlag] = gotodirectory(DirectoryName); |
---|
| 127 | save(FileName, 'EI_G20_P0'); |
---|
| 128 | cd(DirStart); |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | edit soleilinit |
---|
| 132 | Filename = 'exemple4Oleg' |
---|
| 133 | FileName = appendtimestamp(Filename) |
---|
| 134 | getfamilydata('Directory','HU80_TEMPO') |
---|
| 135 | ls |
---|
| 136 | rm HU80_2006-09-12_17-24-36 |
---|
| 137 | remove HU80_2006-09-12_17-24-36 |
---|
| 138 | delete HU80_2006-09-12_17-24-36.mat |
---|
| 139 | ls |
---|
| 140 | dir |
---|
| 141 | help save |
---|
| 142 | doc save |
---|
| 143 | getmcf |
---|
| 144 | pwd |
---|
| 145 | save 'toto' EI |
---|
| 146 | |
---|
| 147 | %%%%%%%%%%%%%% Calculating theoretical Beta values at the positions of BPMs |
---|
| 148 | modelbeta('BPMx') |
---|
| 149 | [bx bz]=modelbeta('BPMx') |
---|
| 150 | bx |
---|
| 151 | [phx, phz] = modelphase('BPMx') |
---|
| 152 | phx |
---|
| 153 | modeltune |
---|
| 154 | [nux nuz] = modeltune |
---|
| 155 | nu = modeltune |
---|
| 156 | |
---|
| 157 | %%%%%%%%%%%%%% Measuring COD vs Corrector Currents (to estimate corrector efficiency) |
---|
| 158 | tableCurInCor = [0 0 0 0; -10 0 0 0; -5 0 0 0; 0 0 0 0; 5 0 0 0; 10 0 0 0; 0 0 0 0; 0 -10 0 0; 0 -5 0 0; 0 0 0 0; 0 5 0 0; 0 10 0 0; 0 0 0 0; 0 0 -10 0; 0 0 -5 0; 0 0 0 0; 0 0 5 0; 0 0 10 0; 0 0 0 0; 0 0 0 -10; 0 0 0 -5; 0 0 0 0; 0 0 0 5; 0 0 0 10] |
---|
| 159 | [fileNames, res] = idMeasCorEffic('HU80_PLEIADES', tableCurInCor, 0, 'C1G200', 1) |
---|
| 160 | |
---|
| 161 | %To measure electron beam and read undulator state, and save the data |
---|
| 162 | %structure to a file |
---|
| 163 | stMeas = idMeasElecBeamUnd('U20_PROXIMA1', 0, 'test_for_chams', 1) |
---|
| 164 | |
---|
| 165 | %to estimate effective field integrals of U20 |
---|
| 166 | st = idCalcFldIntFromElecBeamMeasForUndSOLEIL_1('U20_PROXIMA1', '/home/matlabML/measdata/Ringdata/insertions/U20_PROXIMA1', 'u20_g5_5_2006-09-29_12-29-58', 'u20_g30_2006-09-29_11-59-57', '', -1) |
---|
| 167 | |
---|
| 168 | % Write a table : attributename to be changed |
---|
| 169 | A=[0 1 2 3; |
---|
| 170 | 10 0.2 0.4 0.5; |
---|
| 171 | 20 0.5 0.21 0.45]; |
---|
| 172 | |
---|
| 173 | tango_write_attribute2(dev,'correctionCHEParallelMode',A); |
---|
| 174 | |
---|
| 175 | % how to write at the same time all the correctors |
---|
| 176 | dev= 'ANS-C08/EI/M-HU80.2'; |
---|
| 177 | attr_name_val_list(1).value = 0 |
---|
| 178 | attr_name_val_list(2).value = 0 |
---|
| 179 | attr_name_val_list(3).value = 0 |
---|
| 180 | attr_name_val_list(4).value = 0 |
---|
| 181 | attr_name_val_list(1).name='currentCHE' |
---|
| 182 | attr_name_val_list(2).name='currentCVE' |
---|
| 183 | attr_name_val_list(4).name='currentCVS' |
---|
| 184 | attr_name_val_list(3).name='currentCHS' |
---|
| 185 | |
---|
| 186 | tango_write_attributes(dev,attr_name_val_list); |
---|
| 187 | |
---|
| 188 | % to calculate correction tables for feed-forward |
---|
| 189 | %HU80: |
---|
| 190 | stFileNamesMeasCOD = load('/home/operateur/GrpGMI/HU80_TEMPO/cod_II_filelist_2006-12-10_13-11-12'); |
---|
| 191 | vPhase = [-40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40]; |
---|
| 192 | vGap = [15.5, 16, 18, 20, 22.5, 25, 27.5, 30, 35, 40, 50, 60, 70, 80, 90, 100, 110, 130, 150]; |
---|
| 193 | fileNamesMeasBkg = idAuxPrepFileNameListMeasAndBkg(stFileNamesMeasCOD.filelist, length(vGap)); |
---|
| 194 | arBPM2Skip = [58]; |
---|
| 195 | [mCHE, mCVE, mCHS, mCVS] = idCalcFeedForwardCorTables('HU80_TEMPO', {{'phase', vPhase}, {'gap', vGap}}, fileNamesMeasBkg, '', '', arBPM2Skip); |
---|
| 196 | mCHE_with_Arg = idAuxMergeCorTableWithArg2D(vGap, vPhase, mCHE); |
---|
| 197 | mCVE_with_Arg = idAuxMergeCorTableWithArg2D(vGap, vPhase, mCVE); |
---|
| 198 | mCHS_with_Arg = idAuxMergeCorTableWithArg2D(vGap, vPhase, mCHS); |
---|
| 199 | mCVS_with_Arg = idAuxMergeCorTableWithArg2D(vGap, vPhase, mCVS); |
---|
| 200 | |
---|
| 201 | |
---|
| 202 | |
---|
| 203 | %U20: |
---|
| 204 | stFileNamesMeasCOD = load('/home/operateur/GrpGMI/U20_PROXIMA1/test_cod_filelist_2007-01-24_13-17-20.mat'); |
---|
| 205 | vGap = [30, 27]; |
---|
| 206 | fileNamesMeasBkg = idAuxPrepFileNameListMeasAndBkg(stFileNamesMeasCOD.filename, length(vGap)) |
---|
| 207 | [mCHE, mCVE, mCHS, mCVS] = idCalcFeedForwardCorTables('U20_PROXIMA1', {{'gap', vGap}}, fileNamesMeasBkg, '', '', -1) |
---|
| 208 | |
---|
| 209 | %% |
---|
| 210 | dev = 'ANS-C04/EI/M-HU80.1'; |
---|
| 211 | |
---|
| 212 | tango_write_attribute2(dev,'parallelModeCHE', mCHE_res_with_arg); |
---|
| 213 | tango_write_attribute2(dev,'parallelModeCVE', mCVE_res_with_arg); |
---|
| 214 | tango_write_attribute2(dev,'parallelModeCHS', mCHS_res_with_arg); |
---|
| 215 | tango_write_attribute2(dev,'parallelModeCVS', mCVS_res_with_arg); |
---|
| 216 | |
---|
| 217 | %%To measure COD vs Undulator Param(s) automatically: |
---|
| 218 | [resFileNames, resErrorFlag] = idMeasElecBeamVsUndParam('HU80_TEMPO', {{'phase', [-40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40]}, {'gap', [15.5]}}, {}, inclPerturbMeas, fileNameCore, dispData) |
---|
| 219 | [resFileNames, resErrorFlag] = idMeasElecBeamVsUndParam('HU80_TEMPO', {{'phase', [-40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40], 0.01}, {'gap', [15.5], 0.01}}, {{'gap', 250, 0.01}, {'phase', 0, 0.01}}, 2, 0, 'test', 1) |
---|
| 220 | [resFileNames, resErrorFlag] = idMeasElecBeamVsUndParam('HU80_TEMPO', {{'phase', [-40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40], 0.01}, {'gap', [15.5, 16, 18, 20, 22.5, 25, 27.5, 30, 35, 40, 50, 60, 70, 80, 90, 100, 110, 130, 150], 0.01}}, {{'gap', 250, 0.01}, {'phase', 0, 0.01}}, 1, 0, 'cod_X_01_07', 1) |
---|
| 221 | [resFiles, resErr] = idMeasElecBeamVsUndParam('HU80_PLEIADES', {{'phase', [-40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40], 0.01}, {'gap', [15.5, 16, 18, 20], 0.01}}, {{'gap', 250, 0.01}, {'phase', 0, 0.01}}, 1, 0, 'cod_extra_II', 1) |
---|
| 222 | [resFiles, resErr] = idMeasElecBeamVsUndParam('HU80_CASSIOPEE', {{'phase', [-40,-37.5, -35,-32.5, -30,-27.5, -25,-22.5, -20,-17.5, -15,-12.5, -10,-7.5, -5,-2.5, 0,2.5, 5,7.5, 10,12.5, 15,17.5, 20,22.5, 25,27.5, 30,32.5, 35, 37.5,40], 0.01}, {'gap', [15.5, 16, 18, 20, 22.5, 25, 27.5, 30, 35, 40, 50, 60, 70, 80, 90, 100, 110, 130, 150, 175, 200, 225, 250], 0.01}}, {{'phase', 0, 0.01}, {'gap', 250, 0.01}}, 1, 0, 'cod_1st_test', 1) |
---|
| 223 | [resFiles, resErr] = idMeasElecBeamVsUndParam('HU80_CASSIOPEE', {{'phase', [-40,-37.5, -35,-32.5, -30,-27.5, -25,-22.5, -20,-17.5, -15,-12.5, -10,-7.5, -5,-2.5, 0,2.5, 5,7.5, 10,12.5, 15,17.5, 20,22.5, 25,27.5, 30,32.5, 35, 37.5,40], 0.01}, {'gap', [15.5, 16, 18, 20, 22.5, 25, 27.5, 30, 35, 40, 50, 60, 70, 80, 90, 100, 110, 130, 150, 175, 200, 225, 250], 0.01}}, {{'phase', 0, 0.01}, {'gap', 250, 0.01}}, 1, 0, 'cod_gen_X', 1) |
---|
| 224 | [resFiles, resErr] = idMeasElecBeamVsUndParam('HU80_CASSIOPEE', {{'phase', [40], 0.01}, {'gap', [15.5, 16, 18, 20, 22.5, 25, 27.5, 30, 35, 40, 50, 60, 70, 80, 90, 100, 110, 130, 150], 0.01}}, {{'phase', 0, 0.01}, {'gap', 250, 0.01}}, 1, 0, 'cod_1st_test', 1) |
---|
| 225 | [resFileNames, resErrorFlag] = idMeasElecBeamVsUndParam('U20_PROXIMA1', {{'gap', [5.5, 6, 10], 0.01}}, {{'gap', 30, 0.01}}, 1, 0, 'test_cod', 1) |
---|
| 226 | |
---|
| 227 | %U20 COD meas. and calc. of cor. tables: |
---|
| 228 | [resFileNames, resErrorFlag] = idMeasElecBeamVsUndParam('U20_PROXIMA1', {{'gap', [5.5, 6, 10], 0.01}}, {{'gap', 30, 0.01}}, 1, 0, 'test_cod', 1) |
---|
| 229 | %st.filelist = resFileNames; idSaveStruct(st, 'test_cod_filelist', 'U20_PROXIMA1', 0) |
---|
| 230 | %do something else... |
---|
| 231 | %ls /home/operateur/GrpGMI/U20_PROXIMA1 |
---|
| 232 | %stFileNamesMeasCOD = load('/home/operateur/GrpGMI/U20_PROXIMA1/test_cod_filelist_2007-01-24_14-20-54.mat'); |
---|
| 233 | %vGap = [5.5, 6, 10]; |
---|
| 234 | %fileNamesMeasBkg = idAuxPrepFileNameListMeasAndBkg(stFileNamesMeasCOD.filelist, length(vGap)); |
---|
| 235 | %[mCHE, mCVE, mCHS, mCVS] = idCalcFeedForwardCorTables('U20_PROXIMA1', {{'gap', vGap}}, fileNamesMeasBkg, '', '', -1); |
---|
| 236 | [mCHE, mCVE, mCHS, mCVS] = idCalcFeedForwardCorTables('U20_PROXIMA1', resFileNames.params, resFileNames.filenames_meas_bkg, '', '', -1) |
---|
| 237 | |
---|
| 238 | %CHAMS, I've tested the COD meas. using idMeasElecBeamVsUndParam. It seems to work fine now. 03/02/2007 OC |
---|
| 239 | [resFNames, resErrorFlag] = idMeasElecBeamVsUndParam('U20_PROXIMA1', {{'gap', [29.5, 29.7], 0.01}}, {{'gap', 30, 0.01}}, 1, 0, 'test_cod_to_delete', 1) |
---|
| 240 | |
---|
| 241 | |
---|
| 242 | %Make Bump walking aroung eventual saturation of BPMs: |
---|
| 243 | idSetOrbitBump('BPMx', [4 1;4 2], [4.5,4.5], 'HCOR', [-4,-3,-2,-1,1,2,3,4]); |
---|
| 244 | %Measurement of COD vs Horizontal Bump: |
---|
| 245 | [resBumpMeasPLEIADES, ErrorFlag] = idMeasElecBeamVsUndParamVsBump('HU80_PLEIADES', {{'phase', [-40,-20,0,20,40], 0.01}, {'gap', [15.5], 0.01}}, {{'gap', 250, 0.01}, {'phase', 0, 0.01}}, 2, 0, 'inj_problem', 1, 'H', {[1,1],[-4.5,-4,-3.5,-3,-2.5,-2,-1.5,-1,-0.5,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5]}, [-4,-3,-2,-1,1,2,3,4]); |
---|
| 246 | %Calculation of Field Integrals and other characteristics vs Horizontal Bump: |
---|
| 247 | [vI1x, vI2x, vI1z, vI2z, vPosBump, vKickX1, vKickX2, vKickZ1, vKickZ2, dNuX, dNuZ] = idCalcFldIntVsBumpFromElecBeamMeasForUndSOLEIL('HU80_PLEIADES', '/home/operateur/GrpGMI/GrpGMI/HU80_PLEIADES', resBumpMeasPLEIADES, {{'phase', -40}, {'gap', 15.5}}, '', {[3 3],[3 4],[3 5],[3 6],[3 7],[3 8],[4 1],[4 2],[4 3],[4 4],[4 5],[4 6],[4 7], [5.3]}); |
---|
| 248 | |
---|
| 249 | [vI1xP0c, vI2xP0c, vI1zP0c, vI2zP0c, vPosBumpC, vKickX1P0c, vKickX2P0c, vKickZ1P0c, vKickZ2P0c, dNuXP0c, dNuZP0c] = idCalcFldIntVsBumpFromElecBeamMeasForUndSOLEIL('HU80_CASSIOPEE', '/home/operateur/GrpGMI/HU80_CASSIOPEE', stBumpCAS.resBumpMeas, {{'phase', 0}, {'gap', 15.5}}, '', {[8 1],[8 2],[8 3],[8 4],[8 5],[8 6],[8 7],[9 1],[9 2],[9 3],[9 4],[9 5],[9 6],[9 7]}) |
---|
| 250 | |
---|