Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/m/mdcs/mdc1/models/ltpda_mdc1_actuator.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,161 @@ +% LTPDA_MDC1_ACTUATOR returns a frequency-domain model of the actuators for MDC1. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: LTPDA_MDC1_ACTUATOR returns a frequency-domain model of the actuators +% for MDC1. +% +% CALL: b = ltpda_mdc1_actuator(pl) +% +% PARAMETERS: +% +% 'Actuator' - Choose actuator [default: 'DF'] +% 'DF' - Drag-free actuator +% 'SUS' - Suspension actuator +% 'f' - a vector of frequencies [default: 1] +% or +% 'f1' - start frequency [default: 1e-6] +% 'f2' - stop frequency [default: 5] +% 'nf' - number of frequency points [default: 1000] +% 'scale' - frequency spacing, 'lin' or 'log' [default: 'log'] +% +% VERSION: $Id: ltpda_mdc1_actuator.m,v 1.2 2008/08/08 13:35:23 anneke Exp $ +% +% The following call returns a parameter list object that contains the +% default parameter values: +% +% >> pl = ltpda_mdc1_actuator(ao, 'Params') +% +% The following call returns a string that contains the routine CVS version: +% +% >> version = ltpda_mdc1_actuator(ao,'Version') +% +% The following call returns a string that contains the routine category: +% +% >> category = ltpda_mdc1_actuator(ao,'Category') +% +% HISTORY: 11-04-08 M Hewitson +% Creation +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function varargout = ltpda_mdc1_actuator(varargin) +%%% Check if this is a call for parameters + if utils.helper.isinfocall(varargin{:}) + varargout{1} = getInfo(varargin{3}); + return + end + + %%% Collect input variable names + in_names = cell(size(varargin)); + for ii = 1:nargin,in_names{ii} = inputname(ii);end + + pli = utils.helper.collect_objects(varargin(:), 'plist', in_names); + + %%% Decide on a deep copy or a modify + %%% REMARK: If you create a new AO (call the constructor) then + %%% it is not necessay to copy the input-AOs !!!!!!!!!!!!!!!!!!!!!!!!! + + + %%% Combine plists + pl = combine(pli, getDefaultPlist('Range')); + + + %% Extract parameters from plist + f = find(pl, 'f'); + if isempty(f) + f1 = find(pl, 'f1'); + f2 = find(pl, 'f2'); + nf = find(pl, 'nf'); + scale = find(pl, 'scale'); + + switch scale + case 'lin' + f = linspace(f1, f2, nf); + case 'log' + f = logspace(log10(f1), log10(f2), nf); + end + end + + act = find(pl, 'Actuator'); + + %% Compute response for frequencies f + + switch upper(act) + case 'DF' + a = getDFactuator(f); + case 'SUS' + a = getSUSactuator(f); + otherwise + error('### Unknown actuator requested.'); + end + + varargout{1} = a; +end +%-------------------------------------------------------------------------- +% Get DF controller for each frequency +function o = getSUSactuator(f) + + s = 1i*2*pi*f; + H = 1./(1+s*0.01); + + fsd = fsdata(f, H); + o = ao(fsd); + o.setXunits('Hz'); + o.setYunits('N/N'); + o.setName('A_{sus}'); +end + %-------------------------------------------------------------------------- + % Get DF controller for each frequency +function o = getDFactuator(f) + s = 1i*2*pi*f; + H = 1./(1+s*0.1); + + fsd = fsdata(f, H); + o = ao(fsd); + o.setXunits('Hz'); + o.setYunits('N/N'); + o.setName('A_{df}'); +end +%% Default parameters + +%-------------------------------------------------------------------------- +% Get default params +function plo = getDefaultPlist(varargin) + + % List of available parameter sets + sets = {'List', 'Range'}; + + if nargin == 0 + plo = sets; + return + end + + set = varargin{1}; + + switch set + case 'List' + plo = plist('Actuator', 'DF', 'f', [1]); + case 'Range' + plo = plist('Actuator', 'DF', ... + 'f1', 1e-6,... + 'f2', 5,... + 'nf', 1000,... + 'scale', 'log'); + otherwise + plo = plist(); + end +end +%-------------------------------------------------------------------------- +function ii = getInfo(varargin) + if nargin == 1 && strcmpi(varargin{1}, 'None') + sets = {}; + pl = []; + else + sets = {'Default'}; + pl = getDefaultPlist; + end + % Build info object + ii = minfo(mfilename, 'CLASS', '', 'CATEGORY', '$Id: ltpda_mdc1_actuator.m,v 1.2 2008/08/08 13:35:23 anneke Exp $', sets, pl); +end + +