ltpda_ss_make is the generic function to decalre or load a subsystem. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: ltpda_ss_make is the generic function to decalre or load a subsystem. CALL: subsys = makeSubsystem(varargin) INPUTS: 3 possibilites varargin - plist describibg a subsystem varargin - string, name of a workspace to be loaded where all the parameters content for the plist are contained and named using the corresponding parameter name. varargin - a PZ model to be converted into a state space model (eg.to run a simulation in the time domain later.) OUTPUTS: subsys - subsystem dscribed by a plist subsystem plist format (More updated infos might be available in the ltpda_ss_check function): plist('TYPE', TYPE ,'NAME', NAME ,'TIMESTEP', TIMESTEP ,... 'PARAMNAMES', PARAMNAMES ,'PARAMVALUES', PARAMVALUES ,'PARAMSIGMAS', PARAMSIGMAS ,... 'NBINPUTS', NBINPUTS ,'INPUTNAMES', INPUTNAMES ,'INPUTSIZES', INPUTSIZES ,'INPUTISUSED', INPUTISUSED ,... 'AMAT', AMAT ,'BMATS', BMATS ,'CMAT', CMAT ,'DMATS', DMATS );% PARAMETERS: 'TYPE' should be 'SUBSYSTEM' 'NAME' is a string 'TIMESTEP' is a real positive integer, set to zero in continuous case 'PARAMNAMES' cell array of strings describing parameter variables 'PARAMVALUES' array of doubles (means expected of parameters) 'PARAMSIGMAS' array of doubles (variance expected of parameters) 'NBINPUTS' integer number of inputs 'INPUTNAMES' cell array of strings (name of the inputs) 'INPUTSIZES'array of integers (nb of dimensions of the inputs), 'INPUTISUSED' double array (binary to indicate which inputs are used) 'AMAT' cell array (contains A matrix) 'BMATS' cell array (contains B matrices) 'CMAT' cell array (contains C matrix) 'DMATS' cell array (contains D matrices) ***** THERE ARE NO DEFAULT PARAMETERS ***** VERSION: $Id: ltpda_ss_make.html,v 1.4 2008/03/31 10:27:35 hewitson Exp $ HISTORY: 18-02-2008 A Grynagier 22-01-2008 A Grynagier Creation 02-01-2008 A Grynagier TO DO : finnish and check the iir and plist parts - see also test function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = ltpda_ss_make(varargin) 0002 % ltpda_ss_make is the generic function to decalre or load a subsystem. 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % DESCRIPTION: ltpda_ss_make is the generic function to decalre or load a 0006 % subsystem. 0007 % 0008 % CALL: subsys = makeSubsystem(varargin) 0009 % 0010 % INPUTS: 3 possibilites 0011 % varargin - plist describibg a subsystem 0012 % varargin - string, name of a workspace to be loaded where all the 0013 % parameters content for the plist are contained and named using the 0014 % corresponding parameter name. 0015 % varargin - a PZ model to be converted into a state space model (eg.to run 0016 % a simulation in the time domain later.) 0017 % 0018 % OUTPUTS: subsys - subsystem dscribed by a plist 0019 % 0020 % subsystem plist format (More updated infos might be available in the 0021 % ltpda_ss_check function): 0022 % plist('TYPE', TYPE ,'NAME', NAME ,'TIMESTEP', TIMESTEP ,... 0023 % 'PARAMNAMES', PARAMNAMES ,'PARAMVALUES', PARAMVALUES ,'PARAMSIGMAS', PARAMSIGMAS ,... 0024 % 'NBINPUTS', NBINPUTS ,'INPUTNAMES', INPUTNAMES ,'INPUTSIZES', INPUTSIZES ,'INPUTISUSED', INPUTISUSED ,... 0025 % 'AMAT', AMAT ,'BMATS', BMATS ,'CMAT', CMAT ,'DMATS', DMATS );% PARAMETERS: 0026 % 'TYPE' should be 'SUBSYSTEM' 0027 % 'NAME' is a string 0028 % 'TIMESTEP' is a real positive integer, set to zero in continuous case 0029 % 'PARAMNAMES' cell array of strings describing parameter variables 0030 % 'PARAMVALUES' array of doubles (means expected of parameters) 0031 % 'PARAMSIGMAS' array of doubles (variance expected of parameters) 0032 % 'NBINPUTS' integer number of inputs 0033 % 'INPUTNAMES' cell array of strings (name of the inputs) 0034 % 'INPUTSIZES'array of integers (nb of dimensions of the inputs), 0035 % 'INPUTISUSED' double array (binary to indicate which inputs are used) 0036 % 'AMAT' cell array (contains A matrix) 0037 % 'BMATS' cell array (contains B matrices) 0038 % 'CMAT' cell array (contains C matrix) 0039 % 'DMATS' cell array (contains D matrices) 0040 % ***** THERE ARE NO DEFAULT PARAMETERS ***** 0041 % 0042 % VERSION: $Id: ltpda_ss_make.html,v 1.4 2008/03/31 10:27:35 hewitson Exp $ 0043 % 0044 % HISTORY: 18-02-2008 A Grynagier 0045 % 22-01-2008 A Grynagier 0046 % Creation 02-01-2008 A Grynagier 0047 % 0048 % TO DO : finnish and check the iir and plist parts - see also test function 0049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0050 0051 %% standard calls for LTPDA function data 0052 0053 ALGONAME = mfilename; 0054 VERSION = '$Id: ltpda_ss_make.html,v 1.4 2008/03/31 10:27:35 hewitson Exp $'; 0055 CATEGORY = 'STATESPACE'; 0056 display(['starting ' ALGONAME]); 0057 0058 if not(isempty(varargin)) 0059 if isequal( varargin{1}, 'Version') 0060 varargout = VERSION; 0061 return; 0062 elseif isequal(varargin{1}, 'Params') 0063 varargout = plist('filename','filename'); 0064 return; 0065 elseif isequal(varargin{1}, 'Category') 0066 varargout = CATEGORY; 0067 return; 0068 end 0069 end 0070 0071 system = plist(); 0072 for i=1:nargin 0073 0074 %% proceeding data 0075 if ischar(varargin{i}) 0076 pathbelow = 'private\'; 0077 cmd1 = ['struct = load( ''',pathbelow, varargin{i} , ''' ); ']; 0078 0079 cmd2 = ['subsys = struct.', varargin{i} , '; ']; 0080 eval(cmd1); 0081 eval(cmd2); 0082 ltpda_ss_check(subsys); %#ok<NODEF> 0083 elseif isequal(class(varargin{i}), 'plist object') 0084 subsys = varargin{i}; 0085 ltpda_ss_check(subsys); 0086 elseif isequal(class(varargin{i}), 'pzmodel') 0087 pzm = varargin{i}; 0088 display('not fully implemented yet'); 0089 subsys = ltpda_ss_pz2ss(pzm); 0090 elseif isequal(class(varargin{i}), 'miir') 0091 iir = varargin{i}; 0092 subsys = ltpda_ss_iir2ss(iir); 0093 else 0094 error('wrong type of input: not a string nor a plist object'); 0095 end 0096 ltpda_ss_check(subsys); 0097 system(i) = subsys; 0098 end 0099 varargout = {system}; 0100 0101 end 0102 0103 0104 0105