source: MML/trunk/machine/SOLEIL/StorageRing/insertions/IDStarter/idMeasCorEffic.m @ 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: 1.9 KB
Line 
1function [strAllFileNames, res] = idMeasCorEffic(idName, tableCorCur, inclPerturbMeas, fileNameCore, dispData)
2res = -1;
3
4numMeas = length(tableCorCur);
5timeStandBy = 10;
6curAbsTol = 0.001;
7curToSetCHE = 0;
8curToSetCVE = 0;
9curToSetCHS = 0;
10curToSetCVS = 0;
11fileNameCoreWithCor = fileNameCore;
12strCor = '';
13%strAllFileNames = {};
14strAllFileNames = '';
15
16for i = 1:numMeas
17    curToSetCHE = tableCorCur(i, 1);
18    curToSetCVE = tableCorCur(i, 2);
19        curToSetCHS = tableCorCur(i, 3);
20    curToSetCVS = tableCorCur(i, 4);
21   
22        if (dispData ~= 0)
23        fprintf('\nCurrents: CHE = %f, CVE = %f, CHS = %f, CVS = %f\n', curToSetCHE, curToSetCVE, curToSetCHS, curToSetCVS);
24    end
25
26    res = idSetCorCurSync(idName, curToSetCHE, curToSetCVE, curToSetCHS, curToSetCVS, curAbsTol);
27    if (res ~= 0)
28        fprintf('Failed to set the current values:  %f  %f  %f  %f\nLoop on the current values has stopped abnormally\n', curToSetCHE, curToSetCVE, curToSetCHS, curToSetCVS);
29        return;
30    end
31   
32    strCor = sprintf('_he%i_ve%i_hs%i_vs%i', curToSetCHE, curToSetCVE, curToSetCHS, curToSetCVS);
33    fileNameCoreWithCor = strcat(fileNameCore, strCor);
34   
35    pause(timeStandBy);
36   
37        EIaux = idMeasElecBeamUnd(idName, inclPerturbMeas, fileNameCoreWithCor, dispData);
38   
39    if (strcmp(EIaux.file, '') == 0)
40        if(length(strAllFileNames) > 0)
41            strAllFileNames = strcat(strAllFileNames, '\n');
42        end
43        strAllFileNames = strcat(strAllFileNames, EIaux.file);
44        strAllFileNames = sprintf(strAllFileNames);
45        %strAllFileNames{i} = EIaux.file;
46    end
47end
48
49res = idSetCorCurSync(idName, 0, 0, 0, 0, curAbsTol);
50if (res ~= 0)
51        fprintf('Failed to set the current values:  0  0  0  0\n');
52end
53
54if (strcmp(strAllFileNames, '') == 0)
55%if (length(strAllFileNames) > 0)
56    auxListStruct.file = strAllFileNames;
57    fileNameCoreList = strcat(fileNameCore, '_cor_meas_list');
58    idSaveStruct(auxListStruct, fileNameCoreList, idName, 0);
59end
Note: See TracBrowser for help on using the repository browser.