0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % SSM statespace model class constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: SSM statespace model class constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % CONSTRUCTORS:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % s = ssm() - creates an empty statespace model
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % s = ssm('a1.xml') - creates a new statespace model by loading the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % object from disk.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 % s = ssm('a1.mat') - creates a new statespace model by loading the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % object from disk.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % a = ssm(plist) - creates a statespace model from the description
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 % given in the parameter list
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % a = ssm(struct) - creates a statespace model from the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 % structure returned by struct(ssm).
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 % EXAMPLES:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 % 1) Construct an SSM object by description:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 % name = 'sys';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 % statenames = {'ss1' 'ss2' 'ss3'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 % inputnames = {'input1' 'input2' 'input3'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 % outputnames = {'output1' 'output2' 'output3'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 % timestep = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 % params = plist({'omega', 'system frequency'}, 2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 % amats = cell(3,3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 % bmats = cell(3,3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 % cmats = cell(3,3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 % dmats = cell(3,3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 % amats{1,1} = -(sym('omega'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % amats{2,2} = -2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 % amats{3,3} = -3*eye(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 % amats{3,1} = [-1;-3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 % bmats{1,1} = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 % bmats{2,2} = 2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % bmats{3,3} = 3*eye(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 % cmats{1,1} = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 % cmats{2,2} = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 % cmats{3,3} = eye(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 % dmats{1,3} = [6 6];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % dmats{2,1} = 6;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 % dmats{3,2} = [6;6];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 % sys = ssm(plist( ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 % 'amats',amats, 'bmats',bmats, 'cmats',cmats, 'dmats',dmats, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 % 'timestep',timestep, 'name',name, 'params',params, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 % 'statenames',statenames, 'inputnames',inputnames, 'outputnames',outputnames ));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 % A shortcut (incomplete) syntax is :
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 % sys = ssm( amats, bmats, cmats, dmats, timestep, name, params, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 % statenames, inputnames, outputnames )
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 % Also :
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 % sys = ssm(miirObject);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 % sys = ssm(rationalObject);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 % sys = ssm(parfracObject);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 % More complete call
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 % % here computation of the system's matrices, declaration
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 % % of parameters, some symbolic may be stored in the user
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 % % plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 % sys = struct
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 % SMD_W= 0.2; SMD_C=0.5; SMD_S1=0; SMD_S2=0; SMD_B=1; SMD_D1=0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 % sys.params = plist;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 % sys.amats = {[0 1 ; -SMD_W*SMD_W -2*SMD_C*SMD_W]};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 % sys.cmats = {[1+SMD_S1 SMD_S2]};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 % sys.bmats = {[0;SMD_B] [0 0; 1 0]};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 % sys.dmats = {SMD_D1 [0 1]};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 % sys.timestep = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 % sys.name = 'SRPINGMASSDAMPER';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 % sys.description = 'standard spring-mass-damper test system';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 % inputnames = {'CMD' 'DIST_SMD'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 % inputdescription = {'force noise' 'observation noise'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 % inputvarnames = {{'F'} {'F' 'S'}};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 % inputvarunits = {unit('kg m s^-2') [unit('kg m s^-2') unit('m')]};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 % inputvardescription = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 % ssnames = {'SMD'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 % ssdescription = {'TM position and speed'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 % ssvarnames = {{'x' 'xdot'}};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 % ssvarunits={[unit('m') unit('m s^-1')]};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 % ssvardescription = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 % outputnames = {'SMD'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 % outputdescription = {'observed position'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 % outputvarnames ={{'OBS'}};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 % outputvarunits={unit('m')};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 % outputvardescription = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 % %% Build ssmblocks
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 % sys.inputs = ssmblock.makeBlocksWithData(inputnames, inputdescription, inputvarnames, inputvarunits, inputvardescription);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 % sys.outputs = ssmblock.makeBlocksWithData(outputnames, outputdescription, outputvarnames, outputvarunits, outputvardescription);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 % sys.states = ssmblock.makeBlocksWithData(ssnames, ssdescription, ssvarnames, ssvarunits, ssvardescription);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 % %% plist constructors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 % sys = ssm(plist( ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 % 'amats',sys.amats, 'bmats',sys.bmats, 'cmats',sys.cmats, 'dmats',sys.dmats, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 % 'timestep',0, 'name','sys.name', 'inputs',sys.inputs, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 % 'states', sys.states, 'outputs', sys.outputs));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 % <a href="matlab:utils.helper.displayMethodInfo('ssm', 'ssm')">Parameters Description</a>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 % VERSION: $Id: ssm.m,v 1.199 2011/05/13 15:14:39 ingo Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 classdef ssm < ltpda_uoh
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 %% -------- Public (read/write) Properties -------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 end % End (read/write) Properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 %% -------- Private read-only Properties --------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 properties (SetAccess = protected)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 amats = {}; % A matrix representing a difference/differential term in the state equation, block stored in a cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 bmats = {}; % B matrix representing an input coefficient matrix in the state equation, block stored in a cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 cmats = {}; % C matrix representing the state projection in the observation equation, block stored in a cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 dmats = {}; % D matrix representing the direct feed through term in the observation equation, block stored in a cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 timestep = 0; % Timestep of the difference equation. Zero means the representation is time continuous and A defines a differential equation.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 inputs = ssmblock.initObjectWithSize(1,0); % ssmblock for input blocks
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 states = ssmblock.initObjectWithSize(1,0); % ssmblock describing state blocks
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 outputs = ssmblock.initObjectWithSize(1,0); % ssmblock describing the output blocks
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 numparams = plist.initObjectWithSize(1,1); % nested plist describing the numeric (substituted) parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 params = plist.initObjectWithSize(1,1); % nested plist describing the symbolic parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 end % End read only properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 %% -------- Dependant Properties ---------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 properties (Dependent)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 Ninputs % Number of input-blocks, it is a double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 inputsizes % Size corresponding to each input-block in the B/D matrices. It is a double vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 Noutputs % Number of output-blocks, it is a double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 outputsizes % Size corresponding to each output-block in the C/D matrices. It is a double vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 Nstates % Number of state-blocks, it is a double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 statesizes % Size corresponding to each state-block in the A/B/C matrices. It is a double vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 Nnumparams % number of parameters, a double;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 Nparams % number of parameters, a double;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 isnumerical % This binary tells whether the system has numerical content only, or symbolic as well
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 %% -------- Dependant Properties ---------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 properties (Dependent, Hidden)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 Nss % Number of state-blocks, it is a double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 sssizes % Size corresponding to each state-block in the A/B/C matrices. It is a double vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 inputnames % Cell array with input blocks names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 inputvarnames % Embedded cell array with input ports names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 ssnames % Cell array with states blocks names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 ssvarnames % Embedded cell array with states ports names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 statenames % Cell array with states blocks names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 statevarnames % Embedded cell array with states ports names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 outputnames % Cell array with output blocks names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 outputvarnames % Embedded cell array with output ports names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 paramnames % Cell array with input parameter names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 paramvalues % Double array with input parameter values - may not work with new paramvalue class
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 numparamnames % Cell array with input parameter names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 numparamvalues % Double array with input parameter values - may not work with new paramvalue class
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 end %-------- Protected Properties ---------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 %% -------- Dependant Properties Methods ------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 function value = get.Ninputs(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 value = size(obj.bmats,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 function value = get.inputsizes(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 Ninputs = obj.Ninputs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 Nstates = obj.Nstates;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 Noutputs = obj.Noutputs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 if Nstates==0 && Ninputs~=0 && Noutputs==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 error('This ssm has matrix sizes that make it impossible to determine the property inputsizes (0 states, 1+ inputs and 0 output)')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 value = zeros(1, Ninputs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 for k=1:Ninputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 % b matrix vertically
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 for p=1:Nstates
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 value(k) = size(obj.bmats{p,k} ,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 if value(k)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 break
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 % d matrix vertically
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 if value(k)==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 for p=1:Noutputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 value(k) = size(obj.dmats{p,k} ,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 if value(k)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 break
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 function value = get.Noutputs(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 value = size(obj.cmats,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 function value = get.outputsizes(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 Ninputs = obj.Ninputs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 Nstates = obj.Nstates;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 Noutputs = obj.Noutputs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 if Nstates==0 && Ninputs==0 && Noutputs~=0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 error('This ssm has matrix sizes that make it impossible to determine the property outputsizes (0 states, 0 input and 1+ outputs)')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 value = zeros(1, Noutputs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 for k=1:Noutputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 % c matrix horizontally
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 for p=1:Nstates
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 value(k) = size(obj.cmats{k,p} ,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 if value(k)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 break
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 % d matrix horizontally
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 if value(k)==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 for p=1:Ninputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 value(k) = size(obj.dmats{k,p} ,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 if value(k)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 break
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 function value = get.Nstates(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 value = size(obj.amats,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 function value = get.statesizes(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 Ninputs = obj.Ninputs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 Nstates = obj.Nstates;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 Noutputs = obj.Noutputs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 value = zeros(1, Nstates);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 for k=1:Nstates
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 % b matrix horizontally
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 for p=1:Ninputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 value(k) = size(obj.bmats{k,p}, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 if value(k)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 break
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 % a matrix horizontally
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 if value(k)==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 for p=1:Nstates
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 value(k) = size(obj.amats{k,p}, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 if value(k)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 break
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 % a matrix vertically
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 if value(k)==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 for p=1:Nstates
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 value(k) = size(obj.amats{p,k}, 2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 if value(k)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 break
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 % c matrix vertically
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 if value(k)==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 for p=1:Noutputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 value(k) = size(obj.cmats{p,k}, 2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 if value(k)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 break
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 function value = get.Nss(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 value = obj.Nstates;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 function value = get.sssizes(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 value = obj.statesizes;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 function value = get.Nparams(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 value = obj.params.nparams;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 function value = get.Nnumparams(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 value = obj.numparams.nparams;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 function value = get.isnumerical(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 value = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 for i=1:numel(obj.amats)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 if ~isa(obj.amats{i}, 'double'),
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 value = false; return;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 for i=1:numel(obj.bmats)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 if ~isa(obj.bmats{i}, 'double')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 value = false; return;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 for i=1:numel(obj.cmats)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 if ~isa(obj.cmats{i}, 'double')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 value = false; return;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 for i=1:numel(obj.dmats)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 if ~isa(obj.dmats{i}, 'double')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 value = false; return;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 function names = get.inputnames(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 names = obj.inputs.blockNames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 function names = get.inputvarnames(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325 names = obj.inputs.portNames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 function names = get.ssnames(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 names = obj.statenames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 function names = get.ssvarnames(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 names = obj.statevarnames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 function names = get.statenames(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337 names = obj.states.blockNames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 function names = get.statevarnames(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 names = obj.states.portNames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 function names = get.outputnames(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 names = obj.outputs.blockNames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 function names = get.outputvarnames(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 names = obj.outputs.portNames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 function names = get.paramnames(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353 Nparams = obj.params.nparams;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354 names = cell(1, Nparams);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 for i=1:Nparams
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 names{i} = obj.params.params(i).key;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 function values = get.paramvalues(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 Nparams = obj.params.nparams;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 values = zeros(1, Nparams);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 for i=1:Nparams
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 values(i) = obj.params.params(i).getVal;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 function names = get.numparamnames(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 Nnumparams = obj.numparams.nparams;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 names = cell(1, Nnumparams);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 for i=1:Nnumparams
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 names{i} = obj.numparams.params(i).key;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 function values = get.numparamvalues(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 Nnumparams = obj.numparams.nparams;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 values = zeros(1, Nnumparams);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 for i=1:Nnumparams
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380 values(i) = obj.numparams.params(i).getVal;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384 function set.inputnames(obj, inputnames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 if ~obj.Ninputs == numel(inputnames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 error('### error : Input size is wrong')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 if obj.Ninputs == numel(obj.inputs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 obj.inputs.setBlockNames(inputnames);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 obj.inputs = ssmblock.makeBlocksWithSize(obj.inputsizes, inputnames);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393 % history to be added ?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 function set.statenames(obj, statenames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397 if ~obj.Nstates == numel(statenames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 error('### error : Input size is wrong')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 if (obj.Nstates == numel(obj.states))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401 obj.states.setBlockNames(statenames);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403 obj.states = ssmblock.makeBlocksWithSize(obj.statesizes, statenames);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405 % history to be added ?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408 function set.outputnames(obj, outputnames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409 if ~obj.Noutputs == numel(outputnames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410 error('### error : Input size is wrong')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412 if obj.Noutputs == numel(obj.outputs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413 obj.outputs.setBlockNames(outputnames);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415 obj.outputs = ssmblock.makeBlocksWithSize(obj.outputsizes, outputnames);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 % history to be added ?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420 function set.ssnames(obj, ssnames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421 obj.statenames = ssnames;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 %% -------- constructor ------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427 methods(Access = public)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 function s = ssm(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430 import utils.const.*
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433 % Check the supported version
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434 utils.helper.checkMatlabVersion;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436 % Initialize the properties to make sure that the pointer points to a
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437 % new object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 s.numparams = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439 s.numparams.setName('numparams');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440 s.params = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441 s.params.setName('params');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443 % empty constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444 if nargin == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445 %%%%%%%%%% s = ssm() %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 s.addHistory(ssm.getInfo('ssm', 'None'), plist(), [], []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450 % copy constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451 % Collect all ssm objects to check for copy constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452 sss = utils.helper.collect_objects(varargin(:), 'ssm');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453 if ~isempty(sss)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454 %%%%%%%%%% s = ssm(<ssm objects>) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455 utils.helper.msg(msg.OPROC1, 'copy constructor');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456 s = copy(sss, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
457 for kk=1:numel(s)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
458 s(kk).addHistory(ssm.getInfo('ssm', 'None'), [], [], s(kk).hist);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
459 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
460 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
461 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
462
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
463 % one input constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
464 if (nargin == 1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
465
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
466 % constructor with one object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
467 vin = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
468 if any( strcmp(class(vin), {'pzmodel', 'rational', 'parfrac', 'struct', 'miir', 'ss' } ))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
469 %%%%%%%%%% s = ssm(<model object>) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
470 s = ssm(vin, plist);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
471 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
472 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
473
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
474
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
475 % constructor from a plist with no object inside
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
476 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
477 % the object may only be validated in the constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
478 % the history may only be added in the constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
479 if isa(vin, 'plist')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
480 %%%%%%%%%% s = ssm(<empty plist>) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
481 if vin.nparams == 0 % empty constructor with a plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
482 utils.helper.msg(msg.OPROC1, 'empty constructor %s', varargin{1}.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
483 s.addHistory(ssm.getInfo('ssm', 'None'), vin, [], []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
484 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
485 %%%%%%%%%% s = ssm(<plist with no model object inside>) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
486 elseif isparam(vin,'amats') % construct from a plist description
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
487 utils.helper.msg(msg.OPROC1, 'constructor from a description %s', varargin{1}.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
488 s = ssm.ssmFromDescription(vin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
489 s.addHistory(ssm.getInfo('ssm', 'None'), vin, [], []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
490 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
491 elseif isparam(vin,'Built-in') % Construct from built-in models
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
492 utils.helper.msg(msg.OPROC1, 'constructing from Built-in model %s', varargin{1}.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
493 vin.pset('Built-in', vin.find('Built-in'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
494 if isparam(vin, 'withparams')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
495 error('The WITHPARAMS key has been changed to SYMBOLIC PARAMS. Please check your plist');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
496 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
497 s = fromModel(s,vin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
498 s.validate; % validate when a new object is built
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
499 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
500 elseif isparam(vin,'Hostname') % Retrieve from repository
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
501 utils.helper.msg(msg.OPROC1, 'constructing from repository %s', varargin{1}.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
502 s = s.fromRepository(vin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
503 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
504 elseif isparam(vin,'Filename') % filename constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
505 utils.helper.msg(msg.OPROC1, 'constructing from filename %s', varargin{1}.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
506 s = s.fromFile(vin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
507 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
508
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
509 % constructor from a plist with an object inside
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
510 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
511 % the object is retrieved out of the plist and removed from the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
512 % plist to make it lighter. The input is parsed to the ssm
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
513 % constructor with two inputs. History and validation are done in
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
514 % there.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
515 % There is no message since it is displayed in the call to ssm
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
516 % later on
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
517
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
518 %%%%%%%%%% s = ssm(<plist with model-object inside>) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
519 elseif isparam(vin,'pzmodel')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
520 obj = find(vin, 'pzmodel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
521 vin.remove('pzmodel')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
522 elseif isparam(vin,'rational')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
523 obj = find(vin, 'rational');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
524 vin.remove('rational')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
525 elseif isparam(vin,'parfrac')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
526 obj = find(vin, 'parfrac');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
527 vin.remove('parfrac')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
528 elseif isparam(vin,'struct')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
529 obj = find(vin, 'struct');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
530 vin.remove('struct')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
531 elseif isparam(vin,'miir')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
532 obj = find(vin, 'miir');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
533 vin.remove('miir')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
534 elseif isparam(vin,'ss')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
535 obj = find(vin, 'ss');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
536 vin.remove('ss')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
537 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
538 display('### Unknown ssm constructor could not find a valid parameter key ###')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
539 display('### these are : ''Filename'' ''Built-in'' ''pzmodel'' ''miir'' ''amats'' ###')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
540 display('### ''Hostname'' ''rational'' ''struct'' ''ss'' ###')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
541 error('');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
542 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
543 s = ssm(obj, vin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
544 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
545 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
546
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
547
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
548 % constructor with an input string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
549 if isa(vin, 'char')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
550 %%%%%%%%%% s = ssm(filename) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
551 s = ssm(plist('Filename', vin));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
552 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
553 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
554
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
555 % in the worst case, try with the same input and a plist !? Not
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
556 % Yet (TBD)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
557 display('### Unknown ssm one-object constructor, allowed object classes are: ###')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
558 display('### ''plist'' ''pzmodel'' ''rational'' ''parfrac'' ''struct'' ''miir'' ''ss'' ###')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
559 error('');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
560 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
561
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
562 % two inputs constructors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
563 switch nargin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
564 case 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
565 obj = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
566 pl = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
567
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
568 if isa(pl, 'plist')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
569 if isstruct(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
570 %%%%%%%%%% s = ssm(struct, plist) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
571 utils.helper.msg(msg.OPROC1, 'contructing from a structure');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
572 s = fromStruct(s, obj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
573 doValidate = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
574 elseif isa(obj, 'pzmodel')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
575 %%%%%%%%%% s = ssm(pzmodel, plist) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
576 utils.helper.msg(msg.OPROC1, 'constructing from pzmodel %s', varargin{1}.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
577 s = ssm.ssmFromPzmodel( obj, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
578 doValidate = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
579 elseif isa(obj, 'miir')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
580 %%%%%%%%%% s = ssm(miir, plist) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
581 utils.helper.msg(msg.OPROC1, 'constructing from miir %s', varargin{1}.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
582 s = ssm.ssmFromMiir(obj, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
583 doValidate = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
584 elseif isa(obj, 'ss')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
585 %%%%%%%%%% s = ssm(ss, plist) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
586 utils.helper.msg(msg.OPROC1, 'constructing from ss %s', varargin{1}.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
587 s = ssm.ssmFromss(obj, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
588 doValidate = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
589 elseif isa(obj,'char') && pl.isparam('filename')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
590 %%%%%%%%%% s = ssm(filename, plist) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
591 utils.helper.msg(msg.OPROC1, 'constructing from filename %s', varargin{1}.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
592 filename = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
593 s = s.fromFile(filename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
594 doValidate = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
595 elseif isa(obj, 'rational')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
596 %%%%%%%%%% s = ssm(rational, plist) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
597 utils.helper.msg(msg.OPROC1, 'constructing from rational %s', varargin{1}.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
598 s = ssm.ssmFromRational(obj,pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
599 doValidate = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
600 elseif isa(obj, 'parfrac')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
601 %%%%%%%%%% s = ssm(parFrac) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
602 s = ssm.ssmFromParfrac(obj, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
603 doValidate = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
604 elseif isa(obj, 'ssm') && pl.nparams == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
605 s = ssm(obj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
606 elseif isa(obj, 'plist')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
607 % if for some reason we have two input plists, combine them.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
608 %%%%%%%%%% s = ssm(plist, plist) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
609 s = ssm(obj.combine(plist));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
610 return;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
611 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
612 error(['### Error: ssm constructor cannot accept input of type : ',class(obj)]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
613 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
614
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
615 % Now validate this object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
616 if doValidate
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
617 s.validate();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
618 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
619
|
23
a71a40911c27
Update check for repository connection parameter in constructors
Daniele Nicolodi <nicolodi@science.unitn.it>
diff
changeset
|
620 elseif (isa(varargin{1}, 'database') || isa(varargin{1}, 'java.sql.Connection')) && isnumeric(varargin{2})
|
0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
621 %%%%%%%%%% s = ssm(<database-object>, [IDs]) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
622 utils.helper.msg(msg.OPROC1, 'retrieve from repository');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
623 s = s.fromRepository(plist('conn', varargin{1}, 'id', varargin{2}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
624
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
625 elseif ischar(varargin{1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
626 %%%%%%%%% s = ssm('str1', param1) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
627 s = ssm(plist(varargin{1},varargin{2}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
628 s.validate();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
629
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
630 elseif isa(varargin{1}, 'org.apache.xerces.dom.DeferredElementImpl') && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
631 isa(varargin{2}, 'history')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
632 %%%%%%%%%% obj = ssm(DOM node, history-objects) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
633 s = fromDom(s, varargin{1}, varargin{2});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
634
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
635 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
636 error('### Unknown two parameter constructor.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
637 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
638
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
639 % contructor with more than 2 inputs, which cannot be the copy
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
640 % constructor (done at the beggining)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
641 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
642 if ischar(varargin{1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
643 %%%%%%%%%% s = ssm('str1', param1, 'str2', param2 ...) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
644 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
645 vin = plist(varargin{:});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
646 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
647 error('### Unknown constructor - ssm tried to make a plist with the constructor inputs, but it did not work.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
648 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
649 s = ssm(vin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
650 else % Try shortcut call with a description
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
651 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
652 %%%%%%%%%% s = ssm(amats, bmats, cmats,...) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
653 utils.helper.msg(msg.OPROC1, 'attempting building a description');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
654 keynames = {'amats', 'bmats', 'cmats', 'dmats', 'timestep', 'name', 'params'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
655 'statenames', 'inputnames', 'outputnames' };
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
656 pli = plist;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
657 for i=1:numel(keynames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
658 if i<=nargin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
659 pli.append( plist(keynames{i},varargin{i}) );
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
660 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
661 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
662 s = ssm(pli);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
663 catch ME
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
664 error(ME.identifier, '### Unknown constructor with more than 2 arguments.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
665 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
666 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
667 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
668 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
669
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
670 end % -------- constructor ------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
671
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
672 %% -------- Declaration of hidden methods --------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
673 methods (Hidden = true)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
674
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
675 varargout = setA(varargin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
676 varargout = setB(varargin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
677 varargout = setC(varargin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
678 varargout = setD(varargin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
679
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
680 function clearNumParams(sys)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
681 sys.numparams = plist;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
682 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
683
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
684 function clearAllUnits(sys)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
685 sys.inputs.clearAllUnits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
686 sys.states.clearAllUnits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
687 sys.outputs.clearAllUnits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
688 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
689
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
690
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
691 % completion and error check
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
692 varargout = validate(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
693 % copying one ssm
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
694 varargout = copy(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
695 % process system simplification
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
696 varargout = doSimplify(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
697 % process parameter setting
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
698 varargout = doSetParameters(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
699 % process parameter substitution
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
700 varargout = doSubsParameters(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
701 % re-arrangement of ssm
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
702 sys = reshuffle(sys, inputs1, inputs2, inputs3, states, outputs, outputStates)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
703 % necessary for saving XML files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
704 varargout = attachToDom(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
705 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
706
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
707 %% -------- Declaration of Public Static methods --------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
708 methods (Static=true, Access=public)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
709
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
710 function mdls = getBuiltInModels(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
711 mdls = ltpda_uo.getBuiltInModels('ssm');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
712 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
713
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
714 function ii = getInfo(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
715 ii = utils.helper.generic_getInfo(varargin{:}, 'ssm');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
716 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
717
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
718 function out = VEROUT()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
719 out = '$Id: ssm.m,v 1.199 2011/05/13 15:14:39 ingo Exp $';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
720 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
721
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
722 function out = SETS()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
723 out = [SETS@ltpda_uoh, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
724 {'From Description'}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
725 {'From Pzmodel'}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
726 {'From Miir'}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
727 {'From Rational'}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
728 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
729
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
730 function plout = getDefaultPlist(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
731 persistent pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
732 persistent lastset;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
733 if exist('pl', 'var')==0 || isempty(pl) || ~strcmp(lastset, set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
734 pl = ssm.buildplist(set);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
735 lastset = set;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
736 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
737 plout = pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
738 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
739
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
740 function pl = buildplist(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
741 if ~utils.helper.ismember(lower(ssm.SETS), lower(set))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
742 error('### Unknown set [%s]', set);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
743 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
744 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
745 pl = ssm.addGlobalKeys(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
746 pl = buildplist@ltpda_uoh(pl, set);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
747 switch lower(set) % Select parameter set
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
748
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
749 case 'default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
750 % overide the default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
751 pl = ssm.getDefaultPlist('From Description');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
752
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
753 case 'from built-in model'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
754 % Built-in
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
755 % This is inherited
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
756 pl = plist.FROM_BUILT_IN;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
757 % withParams --> withparams changed to 'symbolic params'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
758 p = param({'symbolic params',['Give a cell-array of parameter names to keep in the expression.<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
759 'By default this is empty and the model will be returned fully numeric.',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
760 'You can also specify ''ALL'' to keep all parameters. Some models don''t support this',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
761 'option; see the specific help of the models for details.']}, {});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
762 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
763 % SETNAMES --> setnames changed to 'param names'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
764 p = param({'param names',['Cell-array of parameter names for user defined values.<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
765 'This way, parameter values can be modified even if they are never used symbolically.']},{});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
766 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
767 % SETVALUES --> setvalues changed to 'param values'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
768 p = param({'param values','Array of parameter values for numerical substitutions.'}, paramValue.EMPTY_DOUBLE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
769 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
770
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
771 case 'from description'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
772
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
773 % States
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
774 p = param({'states','State space blocks.'}, ssmblock.initObjectWithSize(1,0));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
775 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
776 % Outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
777 p = param({'outputs','Output blocks.'}, ssmblock.initObjectWithSize(1,0));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
778 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
779 % Inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
780 p = param({'inputs','Input blocks.'}, ssmblock.initObjectWithSize(1,0));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
781 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
782 % Timestep
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
783 p = param({'timestep',['Timestep of the difference equation. Zero means '...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
784 'the representation is time continuous' ]}, paramValue.DOUBLE_VALUE(0));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
785 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
786 % AMATS
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
787 p = param({'amats',['A matrix representing a difference/differential term in the state equation.',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
788 'Specify as a cell-array of matrices.']}, cell(0,0));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
789 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
790 % BMATS
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
791 p = param({'bmats',['B matrix representing an input coefficient matrix in the state equation.',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
792 'Specify as a cell-array of matrices.']}, cell(0,0));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
793 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
794 % CMATS
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
795 p = param({'cmats',['C matrix representing the state projection in the observation equation.',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
796 'Specify as a cell-array of matrices.']}, cell(0,0));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
797 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
798 % DMATS
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
799 p = param({'dmats',['D matrix representing the direct feed through term in the observation equation.',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
800 'Specify as a cell-array of matrices.']}, cell(0,0));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
801 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
802 % Params
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
803 p = param({'params','Parameter data arrays.'}, {1, {plist}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
804 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
805
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
806 case 'from pzmodel'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
807 p = param({'pzmodel','A pole/zero model object.'}, {1, {pzmodel}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
808 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
809
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
810 case 'from miir'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
811 p = param({'miir','An IIR filter object (MIIR).'}, {1, {miir}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
812 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
813
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
814 case 'from rational'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
815 p = param({'rational','A rational (transfer function) model object.'}, {1, {rational}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
816 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
817
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
818 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
819 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
820
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
821 function obj = initObjectWithSize(n,m)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
822 obj = ssm.newarray([n m]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
823 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
824
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
825 end % End public static methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
826
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
827 %% -------- Declaration of public methods --------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
828 methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
829 varargout = getParams(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
830 varargout = setParams(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
831
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
832 varargout = setBlockProperties(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
833 varargout = setBlockNames(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
834 varargout = setBlockDescriptions(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
835 varargout = setPortProperties(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
836 varargout = setPortNames(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
837 varargout = setPortUnits(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
838 varargout = setPortDescriptions(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
839
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
840 % change timestep
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
841 varargout = modifyTimeStep(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
842 % add, change and subsitute parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
843 varargout = addParameters(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
844 varargout = subsParameters(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
845 varargout = setParameters(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
846 varargout = keepParameters(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
847 varargout = getParameters(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
848 % copy one input block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
849 varargout = duplicateInput(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
850 % assemble systems
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
851 varargout = assemble(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
852 % append systems
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
853 varargout = append(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
854 % transform into a iir
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
855 varargout = ssm2miir(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
856 % transform into a pzmodel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
857 varargout = ssm2pzmodel(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
858 % transform into ABCD doubles/symb
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
859 varargout = double(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
860 % returns aos with impulse or step response
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
861 varargout = resp(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
862 % returns aos with impulse or step response (uses control toolbox)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
863 varargout = respcst(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
864 % transform into a matlab ss object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
865 varargout = ssm2ss(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
866 % simulation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
867 varargout = simulate(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
868 % kalman filter
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
869 varargout = kalman(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
870 % model simplification (variables)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
871 varargout = simplify(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
872 % char
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
873 varargout = char(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
874 % display
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
875 varargout = display(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
876 % give minimal realization
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
877 varargout = MinReal(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
878 % give minimal systematic realization
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
879 varargout = sMinReal(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
880 % tells if ssm is stable
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
881 varargout = isStable(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
882 % returns a value for steady state
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
883 varargout = steadyState(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
884 % returns a value for the system's settling time
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
885 varargout = settlingTime(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
886 % returns a system with output diferrenciated in regards with parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
887 varargout = parameterDiff(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
888 % returns the expected output spectrum of the ssm
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
889 varargout = PSD(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
890 varargout = CPSD(varargin) % takes coupled inputs but does not return individual contributions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
891 % fitting ssm parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
892 varargout = ssmFit(varargin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
893 % reorganize ssm for simulation, PSD, BODE...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
894 varargout = reorganize(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
895 % display ports/plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
896 varargout = displayProperties(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
897 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
898
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
899 methods (Access = private)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
900 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
901
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
902 %% -------- Declaration of Hidden Static methods --------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
903 methods (Static=true, Hidden=true)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
904 % create from miir
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
905 varargout = ssmFromMiir(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
906 % create from rational
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
907 varargout = ssmFromRational(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
908 % create from parfrac object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
909 varargout = ssmFromParfrac(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
910 % create from ss
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
911 varargout = ssmFromss(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
912 % create from plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
913 varargout = ssmFromDescription(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
914 % create from pzmodel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
915 varargout = ssmFromPzmodel(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
916 % subroutines for block defined matrix calculus
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
917 a_out = blockMatRecut(a, rowsizes, colsizes)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
918 a_out = blockMatFusion(a, rowsizes, colsizes)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
919 c = blockMatMult(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
920 a = blockMatAdd(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
921 a = blockMatIndex(amats, blockIndex1, portIndex1, blockIndex2, portIndex2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
922 a = blockMatIndexSym(amats, blockIndex1, portIndex1, blockIndex2, portIndex2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
923 varargout = blockMatPrune(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
924 a = blockMatFillDiag(a, isizes, jsizes)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
925 varargout = loadobj(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
926 varargout = update_struct(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
927 % for built-in models
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
928 varargout = modelHelper_checkParameters(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
929 varargout = modelHelper_processInputPlist(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
930 [params, numParams] = modelHelper_declareParameters(pl, paramNames, paramValues, paramDescriptions, paramUnits)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
931 modelHelper_introScript
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
932 varargout = buildParamPlist(names, value, description, units, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
933 % indexing in a matrix and I/o block arrays, with selection and
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
934 % permuation matrices
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
935 varargout = getMatrixSelection(blockMat, colSizes, oldColumns, newColumns, rowSizes, oldRows, newRows)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
936
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
937 % Chi2 fitting computation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
938 varargout = computeChiFit(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
939 % simulation computation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
940 [x, y, lastX] = doSimulate(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
941 % bode computation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
942 varargout = doBode(a, b, c, d, w, Ts)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
943
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
944 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
945
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
946 methods (Access = protected)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
947 varargout = fromStruct(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
948 varargout = fromDom(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
949 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
950
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
951
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
952 end % End classdef
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
953
|