1 | function PutCurrentAndSaveOrbit(IPS1_ref,IPS2_ref,IPS3_ref,IPS1,IPS2,IPS3,SESSION) |
---|
2 | % |
---|
3 | %Example |
---|
4 | %PutCurrentAndSaveOrbit(0,0,0,1,2,3,'SESSION_06_10_06') |
---|
5 | % |
---|
6 | |
---|
7 | FileNameRefStart=['HU640_PS1_' Num2Str(IPS1_ref) '_PS2_' Num2Str(IPS2_ref) '_PS3_' Num2Str(IPS3_ref) '_' Num2Str(IPS1) '_' Num2Str(IPS2) '_' Num2Str(IPS3) '_Start'] |
---|
8 | FileName=['HU640_PS1_' Num2Str(IPS1) '_PS2_' Num2Str(IPS2) '_PS3_' Num2Str(IPS3)] |
---|
9 | FileNameRefEnd=['HU640_PS1_' Num2Str(IPS1_ref) '_PS2_' Num2Str(IPS2_ref) '_PS3_' Num2Str(IPS3_ref) '_' Num2Str(IPS1) '_' Num2Str(IPS2) '_' Num2Str(IPS3) '_End'] |
---|
10 | |
---|
11 | PathAndFileNameRefStart=['/home/matlabML/measdata/Ringdata/insertions/HU640_DESIRS/' SESSION '/DataInMatlabFormat/' FileNameRefStart]; |
---|
12 | PathAndFileNameRefEnd=['/home/matlabML/measdata/Ringdata/insertions/HU640_DESIRS/' SESSION '/DataInMatlabFormat/' FileNameRefEnd]; |
---|
13 | PathAndFileName=['/home/matlabML/measdata/Ringdata/insertions/HU640_DESIRS/' SESSION '/DataInMatlabFormat/' FileName]; |
---|
14 | idDevServMain01 = 'ans-c05/ei/l-hu640_ps1'; |
---|
15 | idDevServMain02 = 'ans-c05/ei/l-hu640_ps2'; |
---|
16 | idDevServMain03 = 'ans-c05/ei/l-hu640_ps3'; |
---|
17 | |
---|
18 | %Put the Start Reference Current and Save In Matlab Format |
---|
19 | idSetCurrentSync(idDevServMain01, IPS1_ref, 0.1); |
---|
20 | idSetCurrentSync(idDevServMain02, IPS2_ref, 0.1); |
---|
21 | idSetCurrentSync(idDevServMain03, IPS3_ref, 0.1); |
---|
22 | |
---|
23 | pause(20) |
---|
24 | |
---|
25 | Orbit_RefStart=idMeasElecBeamUnd('HU640_DESIRS', 1, PathAndFileNameRefStart, 1); |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | %Put the Nominal Current and Save In Matlab Format |
---|
31 | idSetCurrentSync(idDevServMain01, IPS1, 0.1); |
---|
32 | idSetCurrentSync(idDevServMain02, IPS2, 0.1); |
---|
33 | idSetCurrentSync(idDevServMain03, IPS3, 0.1); |
---|
34 | |
---|
35 | pause(20) |
---|
36 | |
---|
37 | Orbit=idMeasElecBeamUnd('HU640_DESIRS', 1, PathAndFileName, 1); |
---|
38 | |
---|
39 | |
---|
40 | %Put the End Reference Current and Save In Matlab Format |
---|
41 | idSetCurrentSync(idDevServMain01, IPS1_ref, 0.1); |
---|
42 | idSetCurrentSync(idDevServMain02, IPS2_ref, 0.1); |
---|
43 | idSetCurrentSync(idDevServMain03, IPS3_ref, 0.1); |
---|
44 | |
---|
45 | pause(20) |
---|
46 | |
---|
47 | Orbit_RefEnd=idMeasElecBeamUnd('HU640_DESIRS', 1, PathAndFileNameRefEnd, 1); |
---|
48 | |
---|
49 | %Evaluation of the orbit Distortion |
---|
50 | dOrbit_X=Orbit.X-0.5*(Orbit_RefStart.X+Orbit_RefEnd.X); |
---|
51 | dOrbit_Z=Orbit.Z-0.5*(Orbit_RefStart.Z+Orbit_RefEnd.Z); |
---|
52 | |
---|
53 | % Plot Orbit Distortion |
---|
54 | |
---|
55 | BPMx.Position = getspos('BPMx'); |
---|
56 | xdata = BPMx.Position; |
---|
57 | |
---|
58 | |
---|
59 | figure(10) |
---|
60 | plot(xdata,(dOrbit_X),'r.-') |
---|
61 | title('Déplacement relatif d''orbite horizontal') |
---|
62 | xlabel('position des BPM (m)') |
---|
63 | |
---|
64 | figure(11) |
---|
65 | plot(xdata,(dOrbit_Z),'b.-') |
---|
66 | title('Déplacement relatif d''orbite verticale') |
---|
67 | xlabel('position des BPM (m)') |
---|
68 | |
---|
69 | % Plot Orbit before and after nominal current change |
---|
70 | |
---|
71 | figure(12) |
---|
72 | plot(xdata,(Orbit_RefStart.X),'b-',xdata,(Orbit_RefEnd.X),'r-') |
---|
73 | title('Déplacement relatif d''orbite horizontal') |
---|
74 | legend('Before nominal current change','After nominal current change') |
---|
75 | xlabel('position des BPM (m)') |
---|
76 | |
---|
77 | |
---|
78 | figure(13) |
---|
79 | plot(xdata,(Orbit_RefStart.Z),'b-',xdata,(Orbit_RefEnd.Z),'r-') |
---|
80 | title('Déplacement relatif d''orbite verticale') |
---|
81 | legend('Before nominal current change','After nominal current change') |
---|
82 | xlabel('position des BPM (m)') |
---|