comparison m-toolbox/classes/@ssm/ssmFromss.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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % FUNCTION: ssmFromss
4 %
5 % DESCRIPTION: Construct a ltpda statespace object from a matlab statespace
6 % object
7 %
8 % CALL: see ssm, this function is private
9 %
10 % TODO: inplement multiple i/o when subassign function is done
11 %
12 % VERSION : '$Id: ssmFromss.m,v 1.12 2011/04/08 08:56:22 hewitson Exp $';
13 %
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
16 function sys = ssmFromss(varargin)
17
18 VERSION = '$Id: ssmFromss.m,v 1.12 2011/04/08 08:56:22 hewitson Exp $';
19 utils.helper.msg(utils.const.msg.MNAME, ['running ', mfilename]);
20 % get info
21 % Set the method version string in the minfo object
22
23 if nargin ~=2
24 error('ssmFromss need 2 inputs : (obj, plist) ')
25 elseif isa(varargin{1}, 'ss') && isa(varargin{2}, 'plist')
26 pl = varargin{2};
27 ssin = varargin{1};
28 else
29 error('### Please input (<object>,<plist>)');
30 end
31
32 sys = ssm.initObjectWithSize(1,1);
33 sys.name = ssin.Name;
34 if ~ isempty(ssin.Notes)
35 sys.description = ssin.Notes;
36 end
37
38 [a,b,c,d,Ts] = ssdata(ssin) ;
39 sys.amats = {a};
40 sys.bmats = {b};
41 sys.cmats = {c};
42 sys.dmats = {d};
43 sys.timestep = Ts;
44
45 inputstr = 'input';
46 outputstr = 'output';
47 ssstr = 'state';
48
49 sys.inputs = ssmblock.makeBlocksWithData({inputstr},{ssin.inputName}, [], [], [] );
50 sys.outputs = ssmblock.makeBlocksWithData({outputstr},{ssin.outputName}, [], [], [] );
51 sys.states = ssmblock.makeBlocksWithData({ssstr}, {ssin.stateName}, [], [], [] );
52
53 if ~strcmp(pl.find('name'),'None')
54 sys.name = pl.find('name');
55 end
56 if ~strcmp(pl.find('description'),'')
57 sys.description = pl.find('description');
58 end
59
60 end