1 | function outStruct = idReadUndState(inStruct, idType, dispData) |
---|
2 | |
---|
3 | % Reading-in insertion device state, according to its type |
---|
4 | % idType is expected to be: 'HU80_TEMPO', 'U20_PROXIMA1', 'HU640_DESIRS', ... |
---|
5 | |
---|
6 | idDevServMain01 = ''; |
---|
7 | idDevServMain02 = ''; |
---|
8 | idDevServMain03 = ''; |
---|
9 | idDevServCor01 = ''; |
---|
10 | idDevServCor02 = ''; |
---|
11 | idDevServCor03 = ''; |
---|
12 | idDevServCor04 = ''; |
---|
13 | idDevServVac01 = ''; |
---|
14 | |
---|
15 | if strncmp(idType, 'U20', 3) |
---|
16 | if strcmp(idType, 'U20_PROXIMA1') |
---|
17 | idDevServMain01 = 'ans-c10/ei/c-u20_motorscontrol'; %to check the name |
---|
18 | %idDevServCor01 = 'ans-c08/ei/m-hu80.2_chan1'; |
---|
19 | %idDevServCor02 = 'ans-c08/ei/m-hu80.2_chan2'; |
---|
20 | %idDevServCor03 = 'ans-c08/ei/m-hu80.2_chan3'; |
---|
21 | %idDevServCor04 = 'ans-c08/ei/m-hu80.2_chan4'; |
---|
22 | %idDevServVac01 = 'tdl-i08-m/vi/jba.1'; |
---|
23 | elseif strcmp(idType, 'U20_SWING') |
---|
24 | idDevServMain01 = 'ans-c11/ei/c-u20_motorscontrol'; %to check the name |
---|
25 | %idDevServCor01 = 'ans-c08/ei/m-hu80.2_chan1'; |
---|
26 | %idDevServCor02 = 'ans-c08/ei/m-hu80.2_chan2'; |
---|
27 | %idDevServCor03 = 'ans-c08/ei/m-hu80.2_chan3'; |
---|
28 | %idDevServCor04 = 'ans-c08/ei/m-hu80.2_chan4'; |
---|
29 | %idDevServVac01 = 'tdl-i08-m/vi/jba.1'; |
---|
30 | elseif strcmp(idType, 'U20_CRISTAL') |
---|
31 | idDevServMain01 = 'ans-c06/ei/c-u20_motorscontrol'; %to check the name |
---|
32 | %idDevServCor01 = 'ans-c08/ei/m-hu80.2_chan1'; |
---|
33 | %idDevServCor02 = 'ans-c08/ei/m-hu80.2_chan2'; |
---|
34 | %idDevServCor03 = 'ans-c08/ei/m-hu80.2_chan3'; |
---|
35 | %idDevServCor04 = 'ans-c08/ei/m-hu80.2_chan4'; |
---|
36 | %idDevServVac01 = 'tdl-i08-m/vi/jba.1'; |
---|
37 | end |
---|
38 | % Gap encoders |
---|
39 | inStruct.encoder1 = readattribute([idDevServMain01, '/encoder1Position']); |
---|
40 | inStruct.encoder2 = readattribute([idDevServMain01, '/encoder2Position']); |
---|
41 | % Currents in the correction channels |
---|
42 | %inStruct.curCorCh1 = readattribute([idDevServCor, '/...']); |
---|
43 | %inStruct.curCorCh2 = readattribute([idDevServCor, '/...']); |
---|
44 | |
---|
45 | elseif strncmp(idType, 'HU80', 4) |
---|
46 | if strcmp(idType, 'HU80_TEMPO') |
---|
47 | idDevServMain01 = 'ans-c08/ei/m-hu80.2_motorscontrol'; |
---|
48 | idDevServCor01 = 'ans-c08/ei/m-hu80.2_chan1'; |
---|
49 | idDevServCor02 = 'ans-c08/ei/m-hu80.2_chan2'; |
---|
50 | idDevServCor03 = 'ans-c08/ei/m-hu80.2_chan3'; |
---|
51 | idDevServCor04 = 'ans-c08/ei/m-hu80.2_chan4'; |
---|
52 | idDevServVac01 = 'tdl-i08-m/vi/jba.1'; |
---|
53 | elseif strcmp(idType, 'HU80_PLEIADES') |
---|
54 | idDevServMain01 = 'ans-c04/ei/m-hu80.1_motorscontrol'; |
---|
55 | idDevServCor01 = 'ans-c04/ei/m-hu80.1_chan1'; |
---|
56 | idDevServCor02 = 'ans-c04/ei/m-hu80.1_chan2'; |
---|
57 | idDevServCor03 = 'ans-c04/ei/m-hu80.1_chan3'; |
---|
58 | idDevServCor04 = 'ans-c04/ei/m-hu80.1_chan4'; |
---|
59 | idDevServVac01 = 'ans-c04/vi/pi.02'; %to change to tdl when it' installed !!! |
---|
60 | elseif strcmp(idType, 'HU80_CASSIOPEE') |
---|
61 | idDevServMain01 = 'ans-c15/ei/m-hu80.1_motorscontrol'; |
---|
62 | idDevServCor01 = 'ans-c15/ei/m-hu80.1_chan1'; |
---|
63 | idDevServCor02 = 'ans-c15/ei/m-hu80.1_chan2'; |
---|
64 | idDevServCor03 = 'ans-c15/ei/m-hu80.1_chan3'; |
---|
65 | idDevServCor04 = 'ans-c15/ei/m-hu80.1_chan4'; |
---|
66 | idDevServVac01 = 'tdl-i15-m/vi/pi.1'; |
---|
67 | end |
---|
68 | |
---|
69 | % Gap encoders |
---|
70 | inStruct.idEncoder1 = readattribute([idDevServMain01, '/encoder1Position']); |
---|
71 | %inStruct.idEncoder1 = tango_read_attribute2(idDevServMain01, 'encoder1Position'); |
---|
72 | inStruct.idEncoder2 = readattribute([idDevServMain01, '/encoder2Position']); |
---|
73 | %inStruct.idEncoder2 = tango_read_attribute2(idDevServMain01, 'encoder2Position'); |
---|
74 | inStruct.idEncoder3 = readattribute([idDevServMain01, '/encoder3Position']); |
---|
75 | %inStruct.idEncoder3 = tango_read_attribute2(idDevServMain01, 'encoder3Position'); |
---|
76 | inStruct.idEncoder4 = readattribute([idDevServMain01, '/encoder4Position']); |
---|
77 | %inStruct.idEncoder4 = tango_read_attribute2(idDevServMain01, 'encoder4Position'); |
---|
78 | |
---|
79 | % Phase encoders |
---|
80 | inStruct.idEncoder5 = readattribute([idDevServMain01, '/encoder5Position']); |
---|
81 | %inStruct.idEncoder5 = tango_read_attribute2(idDevServMain01, 'encoder5Position'); |
---|
82 | inStruct.idEncoder6 = readattribute([idDevServMain01, '/encoder6Position']); |
---|
83 | %inStruct.idEncoder6 = tango_read_attribute2(idDevServMain01, 'encoder6Position'); |
---|
84 | |
---|
85 | % Currents in the correction channels |
---|
86 | inStruct.idCurCorCh1 = readattribute([idDevServCor01, '/current']); |
---|
87 | inStruct.idCurCorCh2 = readattribute([idDevServCor02, '/current']); |
---|
88 | inStruct.idCurCorCh3 = readattribute([idDevServCor03, '/current']); |
---|
89 | inStruct.idCurCorCh4 = readattribute([idDevServCor04, '/current']); |
---|
90 | |
---|
91 | % Pressure in the ring in the proximity of the SR spot made by the undulator |
---|
92 | inStruct.ringPres = readattribute([idDevServVac01, '/pressure']); |
---|
93 | |
---|
94 | if dispData ~= 0 |
---|
95 | fprintf('pressure = %d\n', inStruct.ringPres); |
---|
96 | fprintf('idEncoder1 = %f\n', inStruct.idEncoder1); |
---|
97 | fprintf('idEncoder2 = %f\n', inStruct.idEncoder2); |
---|
98 | fprintf('idEncoder3 = %f\n', inStruct.idEncoder3); |
---|
99 | fprintf('idEncoder4 = %f\n', inStruct.idEncoder4); |
---|
100 | fprintf('idEncoder5 = %f\n', inStruct.idEncoder5); |
---|
101 | fprintf('idEncoder6 = %f\n', inStruct.idEncoder6); |
---|
102 | fprintf('idCurCorCh1 = %f\n', inStruct.idCurCorCh1); |
---|
103 | fprintf('idCurCorCh2 = %f\n', inStruct.idCurCorCh2); |
---|
104 | fprintf('idCurCorCh3 = %f\n', inStruct.idCurCorCh3); |
---|
105 | fprintf('idCurCorCh4 = %f\n', inStruct.idCurCorCh4); |
---|
106 | end |
---|
107 | elseif strncmp(idType, 'HU256', 5) |
---|
108 | |
---|
109 | elseif strcmp(idType, 'HU640_DESIRS') |
---|
110 | idDevServMain01 = 'ans-c05/ei/l-hu640_ps1'; |
---|
111 | idDevServMain02 = 'ans-c05/ei/l-hu640_ps2'; |
---|
112 | idDevServMain03 = 'ans-c05/ei/l-hu640_ps3'; |
---|
113 | |
---|
114 | % Currents in the main coils |
---|
115 | inStruct.idCurMain1 = readattribute([idDevServMain01, '/current']); |
---|
116 | inStruct.idCurMain2 = readattribute([idDevServMain02, '/current']); |
---|
117 | inStruct.idCurMain3 = readattribute([idDevServMain03, '/current']); |
---|
118 | |
---|
119 | if dispData ~= 0 |
---|
120 | % Display on screen |
---|
121 | fprintf('RMS ecart orbite X = \n') |
---|
122 | fprintf('RMS ecart orbite Z = \n' ) |
---|
123 | fprintf('PS1 = %f\n', inStruct.idCurMain1) |
---|
124 | fprintf('PS2 = %f\n', inStruct.idCurMain2) |
---|
125 | fprintf('PS3 = %f\n', inStruct.idCurMain3) |
---|
126 | end |
---|
127 | end |
---|
128 | outStruct = inStruct; |
---|