Home > classes > @ssm > ssmFromDescription.m

ssmFromDescription

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function sys = ssmFromDescription(pli)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 FUNCTION:    ssmFromDescription

 DESCRIPTION: Construct a statespace model from a plist description

 CALL:        see ssm

 PARAMETER:   

 HISTORY:     15-04-2008 Adrien
              Creation

 TODO:        inplement multiple i/o when subassign function is done
 
 VERSION :    '$Id: ssmFromDescription.m,v 1.14 2008/08/21 19:46:23 adrien Exp $';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0002 %
0003 % FUNCTION:    ssmFromDescription
0004 %
0005 % DESCRIPTION: Construct a statespace model from a plist description
0006 %
0007 % CALL:        see ssm
0008 %
0009 % PARAMETER:
0010 %
0011 % HISTORY:     15-04-2008 Adrien
0012 %              Creation
0013 %
0014 % TODO:        inplement multiple i/o when subassign function is done
0015 %
0016 % VERSION :    '$Id: ssmFromDescription.m,v 1.14 2008/08/21 19:46:23 adrien Exp $';
0017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0018 function sys = ssmFromDescription(pli)
0019 utils.helper.msg(utils.const.msg.MNAME, ['running ', mfilename]);
0020 
0021 % Get default params
0022 pl = combine(pli, ssm.getDefaultPlist('From Description'));
0023 if ~isa(pl,'plist') % checking input type
0024    error(['error because input is not a plist but a ', class(pl)]);
0025 end
0026 
0027 sys(length(pl) ) = ssm;
0028 for i_pl = 1:length(pl) % going through the input
0029    % filling compulsory user defined fields
0030    userfields = {'name','ssnames', 'outputnames', 'inputnames', 'timestep', 'amats', ...
0031      'bmats', 'cmats', 'dmats', 'paramnames', 'paramvalues'};
0032    % other optional fields that may be used defined
0033    otherfields =  {'mmats' 'amats_handles' 'bmats_handles' 'cmats_handles' 'dmats_handles'...
0034      'inputvarnames'  'ssvarnames' 'ssini' 'outputvarnames' 'paramsigmas'};
0035    
0036    for f = userfields
0037       if isparam(pl(i_pl), f{1})
0038          sys.(f{1}) = find(pl(i_pl),f{1});
0039       else
0040          display(['###  ERROR : field in ssm named ''',f{1},''' must be user defined  ###']);
0041          display('###        list of other compulsory user defined  fields        ###')
0042          display(char(userfields))
0043          display('###         list of other optional user defined  fields         ###')
0044          display(char(otherfields))
0045          error(['see above message and lists ^^ ']);
0046       end
0047    end
0048 
0049    for f = otherfields
0050       if isparam(pl(i_pl),f{1})
0051          sys.(f{1}) = find(pl(i_pl),f{1});
0052       end
0053    end
0054    % fields that do not depend on input variables.
0055    sys.addHistory(ssm.getInfo('ssm', 'From Description'), pli, {''}, []);
0056 
0057 end
0058 end

Generated on Mon 25-Aug-2008 22:39:29 by m2html © 2003