comparison m-toolbox/classes/@ssm/displayProperties.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 % DISPAYPROPERTIES displays the ssm model porperties.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DISPAYPROPERTIES displays the ssm model porperties
5 %
6 % CALL: displayProperties(sys , plist)
7 %
8 % INPUTS:
9 % 'sys' - a ssm object to display properties
10 %
11 % <a href="matlab:utils.helper.displayMethodInfo('ssm', 'displayProperties')">Parameters Description</a>
12 %
13 % VERSION : $Id: displayProperties.m,v 1.5 2011/04/08 08:56:22 hewitson Exp $
14 %
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16 function varargout = displayProperties(varargin)
17 %% starting initial checks
18
19 % Check if this is a call for parameters
20 if utils.helper.isinfocall(varargin{:})
21 varargout{1} = getInfo(varargin{3});
22 return
23 end
24
25 utils.helper.msg(utils.const.msg.MNAME, ['running ', mfilename]);
26
27 % Collect input variable names
28 in_names = cell(size(varargin));
29 for ii = 1:nargin,in_names{ii} = inputname(ii); end
30
31 % Collect all SSMs and plists
32 [sys, ssm_invars, rest] = utils.helper.collect_objects(varargin(:), 'ssm', in_names);
33 [pli, invars2, rest] = utils.helper.collect_objects(rest(:), 'plist');
34 if ~isempty(rest)
35 pli = pli.combine(plist(rest{:}));
36 end
37 pli = combine(pli, getDefaultPlist);
38
39 if numel(sys)~=1
40 error(['There should be only one input object to ' mfilename])
41 end
42
43 propName = pli.find('propName');
44
45 switch upper(propName)
46 case 'IOS'
47 doIOS = true;
48 doParameters = false;
49 case 'PARAMETERS'
50 doIOS = false;
51 doParameters = true;
52 otherwise
53 doIOS = true;
54 doParameters = true;
55 end
56
57 %% display inputs/states/outputs
58 nInputs = sys.Ninputs;
59 nStates = sys.Nstates;
60 nOutputs = sys.Noutputs;
61
62 if doIOS
63 display(['MODEL INFORMATION OF : ' sys.name])
64 display(sys.description)
65 display(['===========INPUTS===========' ])
66 display([' number of blocks : ' num2str(nInputs) ])
67
68 for i=1:nInputs
69 blk = sys.inputs(i);
70 display([' input number ' num2str(i) ' : "' blk.name '"'])
71 display([' input description : ' blk.description ])
72 display([' number of ports : ' num2str(numel(blk.ports)) ])
73 for j=1:numel(blk.ports)
74 p = blk.ports(j);
75 display([' port number ' num2str(j) ' : ' p.name ' ' char(p.units) ' - ' p.description ])
76 end
77 end
78 display(['===========STATES===========' ])
79 display([' number of blocks : ' num2str(nStates) ])
80 for i=1:nStates
81 blk = sys.states(i);
82 display([' state ' num2str(i) ' : "' blk.name '"'])
83 display([' state description : ' blk.description ])
84 display([' state size : ' num2str(numel(blk.ports)) ])
85 for j=1:numel(blk.ports)
86 p = blk.ports(j);
87 display([' port number ' num2str(j) ' : ' p.name ' ' char(p.units) ' - ' p.description ])
88 end
89 end
90 display(['===========OUTPUTS===========' ])
91 display([' number of blocks : ' num2str(nOutputs) ])
92 for i=1:nOutputs
93 blk = sys.outputs(i);
94 display([' output ' num2str(i) ' : "' blk.name '"'])
95 display([' output description : ' blk.description ])
96 display([' output size : ' num2str(numel(blk.ports)) ])
97 for j=1:numel(blk.ports)
98 p = blk.ports(j);
99 display([' port number ' num2str(j) ' : ' p.name ' ' char(p.units) ' - ' p.description ])
100 end
101 end
102 end
103 %% display parameters
104 if doParameters
105 p1 = sys.params.params;
106 p2 = sys.numparams.params;
107 display(['===========MODEL INFORMATION OF : ' sys.name '==========='])
108 display(sys.description)
109 display(['Number of symbolic parameters : ' num2str(sys.params.nparams)]);
110 for i = 1:numel(p1)
111 pv = p1(i).val;
112 if ~isempty(pv.property) && ~isempty(pv.property.units)
113 display([ ' sym. parameter number ' num2str(i) ' : ' p1(i).key ' = ' num2str(pv.options{pv.valIndex}) ' ' char(pv.property.units) ' - ' p1(i).desc]);
114 else
115 display([ ' sym. parameter number ' num2str(i) ' : ' p1(i).key ' = ' num2str(pv.options{pv.valIndex}) ' - ' p1(i).desc]);
116 end
117 end
118 display(['Number of numerical parameters : ' num2str(sys.numparams.nparams)]);
119 for i = 1:numel(p2)
120 pv = p2(i).val;
121 if ~isempty(pv.property) && ~isempty(pv.property.units)
122 display([ ' num. parameter number ' num2str(i) ' : ' p2(i).key ' = ' num2str(pv.options{pv.valIndex}) ' ' char(pv.property.units) ' - ' p2(i).desc]);
123 else
124 display([ ' num. parameter number ' num2str(i) ' : ' p2(i).key ' = ' num2str(pv.options{pv.valIndex}) ' - ' p2(i).desc]);
125 end
126 end
127 end
128 end
129
130
131
132 %--------------------------------------------------------------------------
133 % Get Info Object
134 %--------------------------------------------------------------------------
135 function ii = getInfo(varargin)
136
137 if nargin == 1 && strcmpi(varargin{1}, 'None')
138 sets = {};
139 pl = [];
140 else
141 sets = {'Default'};
142 pl = getDefaultPlist;
143 end
144 % Build info object
145 ii = minfo(mfilename, 'ssm', 'ltpda', utils.const.categories.output, '$Id: displayProperties.m,v 1.5 2011/04/08 08:56:22 hewitson Exp $', sets, pl);
146 end
147
148 %--------------------------------------------------------------------------
149 % Get Default Plist
150 %--------------------------------------------------------------------------
151 function pl = getDefaultPlist()
152 pl = plist();
153 % plist
154 p = param({'propName','Choose to display all, or only block and port data, or only parameter data.'},...
155 {1, {'ALL', 'ISO' , 'parameters'}, paramValue.SINGLE});
156 pl.append(p);
157 end
158