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.16 2008/08/30 19:45:08 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.16 2008/08/30 19:45:08 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'};
0032    % other optional fields that may be used defined
0033    otherfields =  {'mmats' 'amats_handles' 'bmats_handles' 'cmats_handles' 'dmats_handles'...
0034      'inputvarnames'  'ssvarnames' 'outputvarnames' ...
0035      'paramnames' 'paramvalues' 'paramsigmas'};
0036    
0037    for f = userfields
0038       if isparam(pl(i_pl), f{1})
0039          sys(i_pl).(f{1}) = find(pl(i_pl),f{1});
0040       else
0041          display(['###  ERROR : field in ssm named ''',f{1},''' must be user defined  ###']);
0042          display('###        list of other compulsory user defined  fields        ###')
0043          display(char(userfields))
0044          display('###         list of other optional user defined  fields         ###')
0045          display(char(otherfields))
0046          error(['see above message and lists ^^ ']);
0047       end
0048    end
0049 
0050    for f = otherfields
0051       if isparam(pl(i_pl),f{1})
0052          sys(i_pl).(f{1}) = find(pl(i_pl),f{1});
0053       end
0054    end
0055    % fields that do not depend on input variables.
0056    sys(i_pl).addHistory(ssm.getInfo('ssm', 'From Description'), pli(i_pl), {''}, []);
0057 
0058 end
0059 end

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003