Mercurial > hg > ltpda
comparison m-toolbox/m/mdcs/mdc1/ltpda_mdc1_ifo2acc_fd.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % LTPDA_MDC1_IFO2ACC_FS calculates the external acceleration in the frequency-domain. | |
2 % | |
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
4 % | |
5 % DESCRIPTION: LTPDA_MDC1_IFO2ACC_FS calculates the external acceleration in | |
6 % the frequency-domain for MDC1. | |
7 % | |
8 % It computes: a = [DS^-1 + C]o | |
9 % | |
10 % CALL: b = ltpda_mdc1_ifo2acc_fd(pl) | |
11 % | |
12 % PARAMETERS: | |
13 % | |
14 % 'Omega1' - the square of the stiffness term for the dynamical response | |
15 % of test-mass 1 coupling to SC [default: 1.3e-6] | |
16 % 'Omega3' - the square of the stiffness term for the dynamical response | |
17 % of test-mass 2 coupling to SC [default: 2e-6] | |
18 % 'delta' - the cross-coupling factor of o1 into o12 [default: -1e-4] | |
19 % 'o1xx' - spectral estimate of the IFO output o1 [default: empty ao] | |
20 % 'o12xx' - spectral estimate of the IFO output o12 [default: empty ao] | |
21 % 'o112xx' - cross-spectral estimate of the IFO output o1 and o12 [default: empty ao] | |
22 % | |
23 % VERSION: $Id: ltpda_mdc1_ifo2acc_fd.m,v 1.4 2008/08/08 13:35:23 anneke Exp $ | |
24 % | |
25 % The following call returns a parameter list object that contains the | |
26 % default parameter values: | |
27 % | |
28 % >> pl = ltpda_mdc1_ifo2acc_fd(ao, 'Params') | |
29 % | |
30 % The following call returns a string that contains the routine CVS version: | |
31 % | |
32 % >> version = ltpda_mdc1_ifo2acc_fd(ao,'Version') | |
33 % | |
34 % The following call returns a string that contains the routine category: | |
35 % | |
36 % >> category = ltpda_mdc1_ifo2acc_fd(ao,'Category') | |
37 % | |
38 % HISTORY: 11-04-08 M Hewitson | |
39 % Creation | |
40 % | |
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
42 function varargout = ltpda_mdc1_ifo2acc_fd(varargin) | |
43 %%% Check if this is a call for parameters | |
44 if utils.helper.isinfocall(varargin{:}) | |
45 varargout{1} = getInfo(varargin{3}); | |
46 return | |
47 end | |
48 | |
49 %%% Collect input variable names | |
50 in_names = cell(size(varargin)); | |
51 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
52 | |
53 pli = utils.helper.collect_objects(varargin(:), 'plist', in_names); | |
54 | |
55 %%% Decide on a deep copy or a modify | |
56 %%% REMARK: If you create a new AO (call the constructor) then | |
57 %%% it is not necessay to copy the input-AOs !!!!!!!!!!!!!!!!!!!!!!!!! | |
58 | |
59 | |
60 %%% Combine plists | |
61 pl = combine(pli, getDefaultPlist); | |
62 | |
63 %% Extract parameters from plist | |
64 | |
65 % Get parameters out | |
66 w1 = find(pl, 'Omega1'); | |
67 w3 = find(pl, 'Omega3'); | |
68 delta = find(pl, 'delta'); | |
69 o1xx = find(pl, 'o1xx'); | |
70 o12xx = find(pl, 'o12xx'); | |
71 o112xx = find(pl, 'o112xx'); | |
72 | |
73 if isempty(o1xx.data) || isempty(o12xx.data) || isempty(o112xx.data) | |
74 error('### Please provide three input spectra.'); | |
75 end | |
76 if ~isequal(o1xx.data.x, o12xx.data.x, o112xx.data.x) | |
77 error('### The two input spectra should be computed at the same frequencies.'); | |
78 end | |
79 | |
80 % Get frequency vector from one of the input spectra | |
81 f = o1xx.data.x; | |
82 | |
83 %% Compute response for frequencies f | |
84 | |
85 [a11xx, a22xx] = computeAcc(f, w1, w3, delta, o1xx, o12xx, o112xx); | |
86 | |
87 varargout{1} = a11xx; | |
88 varargout{2} = a22xx; | |
89 end | |
90 %-------------------------------------------------------------------------- | |
91 % Get DF controller for each frequency | |
92 function [a11xx, a22xx] = computeAcc(f, w1, w3, delta, o1xx, o12xx, o112xx) | |
93 | |
94 % A model of the downsampling from 100 to 10Hz | |
95 pl = plist('gain',1, 'poles', [pz(10), pz(10), pz(10)], 'zeros', []); | |
96 pzm = pzmodel(pl); | |
97 ds = resp(pzm, plist('f', f)); | |
98 | |
99 % Drag-free | |
100 Cdf = ltpda_mdc1_C(plist('f', f, 'Controller', 'df')); | |
101 Adf = ltpda_mdc1_actuator(plist('f', f, 'Actuator', 'df')); | |
102 Cdf = ds.*Cdf.*Adf; | |
103 Sw1 = ltpda_mdc1_dynamics(plist('f', f, 'Omega2', w1.data.y.^2)); | |
104 Sw1.setName('Sw1', 'internal'); | |
105 | |
106 % Suspension | |
107 Csus = ltpda_mdc1_C(plist('f', f, 'Controller', 'sus')); | |
108 Asus = ltpda_mdc1_actuator(plist('f', f, 'Actuator', 'sus')); | |
109 Csus = ds.*Csus.*Asus; | |
110 Sw3 = ltpda_mdc1_dynamics(plist('f', f, 'Omega2', w3.data.y.^2)); | |
111 Sw3.setName('Sw3', 'internal'); | |
112 | |
113 % Square terms for dealing with PSDs | |
114 Csusxx = abs(Csus).^2; | |
115 Cdfxx = abs(Cdf).^2; | |
116 Sw1xx = abs(Sw1).^2; | |
117 Sw3xx = abs(Sw3).^2; | |
118 | |
119 wd = w3.^2-w1.^2; | |
120 beta = wd - delta.*Sw3; | |
121 bxx = abs(beta).^2; | |
122 | |
123 % Calibrate back to a1 | |
124 | |
125 a11xx = o1xx .* (Sw1xx + Cdfxx - Cdf.*conj(Sw1) - conj(Cdf).*Sw1); | |
126 a11xx.setName('PSD(a11)', 'internal'); | |
127 | |
128 % Calibrate back to a2 | |
129 | |
130 e1 = o1xx.*bxx; | |
131 e2 = sqrt(o12xx).*Sw3; | |
132 e3 = sqrt(o12xx).*Csus; | |
133 a22t1 = e1 + abs(e2 - e3).^2; | |
134 | |
135 a22t2 = beta.*(conj(Sw3)+conj(Csus)).*o112xx; | |
136 a22t3 = conj(beta).*(Sw3+Csus).*o112xx; | |
137 a22xx = abs(a22t1 ... | |
138 + a22t2 ... | |
139 + a22t3); | |
140 a22xx.setName('PSD(a22)', 'internal'); | |
141 end | |
142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
143 % Local Functions % | |
144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
145 | |
146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
147 % | |
148 % FUNCTION: getInfo | |
149 % | |
150 % DESCRIPTION: Get Info Object | |
151 % | |
152 % HISTORY: 11-07-07 M Hewitson | |
153 % Creation. | |
154 % | |
155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
156 | |
157 function ii = getInfo(varargin) | |
158 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
159 sets = {}; | |
160 pl = []; | |
161 else | |
162 sets = {'Default'}; | |
163 pl = getDefaultPlist; | |
164 end | |
165 % Build info object | |
166 ii = minfo(mfilename, 'CLASS', '', 'CATEGORY', '$Id: ltpda_mdc1_ifo2acc_fd.m,v 1.4 2008/08/08 13:35:23 anneke Exp $', sets, pl); | |
167 end | |
168 | |
169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
170 % | |
171 % FUNCTION: getDefaultPlist | |
172 % | |
173 % DESCRIPTION: Get Default Plist | |
174 % | |
175 % HISTORY: 11-07-07 M Hewitson | |
176 % Creation. | |
177 % | |
178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
179 | |
180 function plo = getDefaultPlist() | |
181 plo = plist('Omega1', 1.3e-6, ... | |
182 'Omega3', 2e-6, ... | |
183 'delta', -1e-4, ... | |
184 'o1xx', ao, ... | |
185 'o12xx', ao, ... | |
186 'o112xx', ao); | |
187 end | |
188 | |
189 |