1 | function rsp = response2rsp(datastruct,rsp,plane) |
---|
2 | %RESPONSE2RSP - Loads middlelayer response matrix data format into orbit program response structure |
---|
3 | % |
---|
4 | % INPUTS |
---|
5 | % 1. rsp = model orbit program response structure |
---|
6 | % 2. datastruct = middlelayer response matrix data format |
---|
7 | % |
---|
8 | % OUTPUTS |
---|
9 | % rsp = modified orbit program response structure |
---|
10 | |
---|
11 | % |
---|
12 | % Written by William J. Corbett |
---|
13 | % Modified by Laurent S. Nadolski |
---|
14 | |
---|
15 | % BPMFamily = {'BPMx', 'BPMz'}; |
---|
16 | % CORFamily = {'HCOR' , 'VCOR' }; |
---|
17 | global BPM COR |
---|
18 | |
---|
19 | [BPMFamily{1}, BPMFamily{2}] = BPM.AOFamily; |
---|
20 | [CORFamily{1}, CORFamily{2}] = COR.AOFamily; |
---|
21 | |
---|
22 | temp = datastruct; |
---|
23 | |
---|
24 | if iscell(temp) |
---|
25 | temp = temp{1} |
---|
26 | end |
---|
27 | |
---|
28 | if ~exist('plane','var') % treat both planes |
---|
29 | for ip = 1:2 |
---|
30 | rsp(ip).ib = dev2elem(BPMFamily{ip},temp(ip,ip).Monitor.DeviceList); %BPM index list |
---|
31 | rsp(ip).ic = dev2elem(CORFamily{ip},temp(ip,ip).Actuator.DeviceList); %corrector index list |
---|
32 | rsp(ip).Data = temp(ip,ip).Data; %response matrix INCLUDING NaN ENTRIES |
---|
33 | rsp(ip).ActuatorDelta = temp(ip,ip).ActuatorDelta; %corrector currents |
---|
34 | end |
---|
35 | else % treat one single plane |
---|
36 | ip = plane; |
---|
37 | rsp.ib = dev2elem(BPMFamily{ip},temp.Monitor.DeviceList); %BPM index list |
---|
38 | rsp.ic = dev2elem(CORFamily{ip},temp.Actuator.DeviceList); %corrector index list |
---|
39 | rsp.Data = temp.Data; %response matrix INCLUDING NaN ENTRIES |
---|
40 | rsp.ActuatorDelta = temp.ActuatorDelta; %corrector currents |
---|
41 | end |
---|