comparison m-toolbox/m/mdcs/mdc1/models/ltpda_mdc1_actuator.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_ACTUATOR returns a frequency-domain model of the actuators for MDC1.
2 %
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % DESCRIPTION: LTPDA_MDC1_ACTUATOR returns a frequency-domain model of the actuators
6 % for MDC1.
7 %
8 % CALL: b = ltpda_mdc1_actuator(pl)
9 %
10 % PARAMETERS:
11 %
12 % 'Actuator' - Choose actuator [default: 'DF']
13 % 'DF' - Drag-free actuator
14 % 'SUS' - Suspension actuator
15 % 'f' - a vector of frequencies [default: 1]
16 % or
17 % 'f1' - start frequency [default: 1e-6]
18 % 'f2' - stop frequency [default: 5]
19 % 'nf' - number of frequency points [default: 1000]
20 % 'scale' - frequency spacing, 'lin' or 'log' [default: 'log']
21 %
22 % VERSION: $Id: ltpda_mdc1_actuator.m,v 1.2 2008/08/08 13:35:23 anneke Exp $
23 %
24 % The following call returns a parameter list object that contains the
25 % default parameter values:
26 %
27 % >> pl = ltpda_mdc1_actuator(ao, 'Params')
28 %
29 % The following call returns a string that contains the routine CVS version:
30 %
31 % >> version = ltpda_mdc1_actuator(ao,'Version')
32 %
33 % The following call returns a string that contains the routine category:
34 %
35 % >> category = ltpda_mdc1_actuator(ao,'Category')
36 %
37 % HISTORY: 11-04-08 M Hewitson
38 % Creation
39 %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 function varargout = ltpda_mdc1_actuator(varargin)
42 %%% Check if this is a call for parameters
43 if utils.helper.isinfocall(varargin{:})
44 varargout{1} = getInfo(varargin{3});
45 return
46 end
47
48 %%% Collect input variable names
49 in_names = cell(size(varargin));
50 for ii = 1:nargin,in_names{ii} = inputname(ii);end
51
52 pli = utils.helper.collect_objects(varargin(:), 'plist', in_names);
53
54 %%% Decide on a deep copy or a modify
55 %%% REMARK: If you create a new AO (call the constructor) then
56 %%% it is not necessay to copy the input-AOs !!!!!!!!!!!!!!!!!!!!!!!!!
57
58
59 %%% Combine plists
60 pl = combine(pli, getDefaultPlist('Range'));
61
62
63 %% Extract parameters from plist
64 f = find(pl, 'f');
65 if isempty(f)
66 f1 = find(pl, 'f1');
67 f2 = find(pl, 'f2');
68 nf = find(pl, 'nf');
69 scale = find(pl, 'scale');
70
71 switch scale
72 case 'lin'
73 f = linspace(f1, f2, nf);
74 case 'log'
75 f = logspace(log10(f1), log10(f2), nf);
76 end
77 end
78
79 act = find(pl, 'Actuator');
80
81 %% Compute response for frequencies f
82
83 switch upper(act)
84 case 'DF'
85 a = getDFactuator(f);
86 case 'SUS'
87 a = getSUSactuator(f);
88 otherwise
89 error('### Unknown actuator requested.');
90 end
91
92 varargout{1} = a;
93 end
94 %--------------------------------------------------------------------------
95 % Get DF controller for each frequency
96 function o = getSUSactuator(f)
97
98 s = 1i*2*pi*f;
99 H = 1./(1+s*0.01);
100
101 fsd = fsdata(f, H);
102 o = ao(fsd);
103 o.setXunits('Hz');
104 o.setYunits('N/N');
105 o.setName('A_{sus}');
106 end
107 %--------------------------------------------------------------------------
108 % Get DF controller for each frequency
109 function o = getDFactuator(f)
110 s = 1i*2*pi*f;
111 H = 1./(1+s*0.1);
112
113 fsd = fsdata(f, H);
114 o = ao(fsd);
115 o.setXunits('Hz');
116 o.setYunits('N/N');
117 o.setName('A_{df}');
118 end
119 %% Default parameters
120
121 %--------------------------------------------------------------------------
122 % Get default params
123 function plo = getDefaultPlist(varargin)
124
125 % List of available parameter sets
126 sets = {'List', 'Range'};
127
128 if nargin == 0
129 plo = sets;
130 return
131 end
132
133 set = varargin{1};
134
135 switch set
136 case 'List'
137 plo = plist('Actuator', 'DF', 'f', [1]);
138 case 'Range'
139 plo = plist('Actuator', 'DF', ...
140 'f1', 1e-6,...
141 'f2', 5,...
142 'nf', 1000,...
143 'scale', 'log');
144 otherwise
145 plo = plist();
146 end
147 end
148 %--------------------------------------------------------------------------
149 function ii = getInfo(varargin)
150 if nargin == 1 && strcmpi(varargin{1}, 'None')
151 sets = {};
152 pl = [];
153 else
154 sets = {'Default'};
155 pl = getDefaultPlist;
156 end
157 % Build info object
158 ii = minfo(mfilename, 'CLASS', '', 'CATEGORY', '$Id: ltpda_mdc1_actuator.m,v 1.2 2008/08/08 13:35:23 anneke Exp $', sets, pl);
159 end
160
161