Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LRT_infinite_dimensional_systems
conI
Commits
69c55e12
Commit
69c55e12
authored
Sep 25, 2020
by
Jakob Gabriel
Browse files
revised misc.getMinimalInternalModel, lead to minor changes in misc.ss.odes
parent
f047e026
Changes
4
Hide whitespace changes
Inline
Side-by-side
+misc/+ss/Odes.m
View file @
69c55e12
...
...
@@ -206,6 +206,16 @@ classdef Odes < handle & matlab.mixin.Copyable
end
end
% isequal()
function
B
=
BofInputName
(
obj
,
inputName
)
arguments
obj
misc
.
ss
.
Odes
;
inputName
(
1
,
1
)
string
;
end
InputNames
=
misc
.
ss
.
removeEnumeration
(
obj
.
InputName
);
B
=
obj
.
odes
.
B
;
B
=
B
(:,
strcmp
(
InputNames
,
inputName
));
end
% BofInputName
function
[
ic
,
stateName
]
=
getInitialCondition
(
obj
,
varargin
)
% getInitialCondition reads varargin if there are initial conditions
% defined as name-value-pair with the name according to obj.stateName and
...
...
@@ -370,8 +380,9 @@ classdef Odes < handle & matlab.mixin.Copyable
end
% change C and D in mySs
mySs
=
set
(
mySs
,
'C'
,
eye
(
size
(
mySs
.
A
)),
'D'
,
zeros
(
size
(
mySs
.
A
,
1
),
size
(
mySs
.
B
,
2
)));
mySs
=
misc
.
ss
.
setSignalName
(
mySs
,
'output'
,
{
type
},
size
(
mySs
.
A
,
1
));
mySs
=
ss
(
mySs
.
A
,
mySs
.
B
,
eye
(
size
(
mySs
.
A
)),
zeros
(
size
(
mySs
.
A
,
1
),
size
(
mySs
.
B
,
2
)),
...
mySs
.
Ts
,
"InputName"
,
mySs
.
InputName
,
...
"OutputName"
,
type
+
"("
+
(
1
:
1
:
size
(
mySs
.
A
,
1
))
.'
+
")"
);
end
% if
end
% function [ss, C] = seperateCfromSs(ss)
...
...
+misc/+ss/simulationOutput2Quantity.m
View file @
69c55e12
...
...
@@ -110,14 +110,12 @@ for idx = 1 : numel(signalNames)
z
=
quantity
.
Domain
(
"z"
,
thisGrid
{
1
});
end
quantityStruct
=
misc
.
setfield
(
quantityStruct
,
signalNames
{
idx
},
...
quantity
.
Discrete
(
thisSignalSorted
,
[
t
,
z
],
...
'name'
,
signalNames
{
idx
}));
quantity
.
Discrete
(
thisSignalSorted
,
[
t
,
z
],
'name'
,
signalNames
{
idx
}));
else
quantityStruct
=
misc
.
setfield
(
quantityStruct
,
signalNames
{
idx
},
...
quantity
.
Discrete
(
...
simOutput
(:,
strcmp
(
outputNamesUnenumerated
,
signalNames
{
idx
})),
t
,
...
'name'
,
signalNames
{
idx
}));
quantity
.
Discrete
(
simOutput
(:,
strcmp
(
outputNamesUnenumerated
,
signalNames
{
idx
})),
t
,
...
'name'
,
signalNames
{
idx
}));
end
end
end
...
...
+misc/getMinimalInternalModel.m
View file @
69c55e12
function
[
myOde
,
trackingSum
,
spectrumIndividual
]
=
getMinimalInternalModel
(
...
function
[
myOde
,
spectrumIndividual
]
=
getMinimalInternalModel
(
...
S
,
inputVectorMode
,
numberOfCopies
,
...
stateName
,
trackingErrorSignal
Name
,
outputSignalName
,
referenceSignalName
)
stateName
,
internalModelInput
Name
,
outputSignalName
,
referenceSignalName
)
%misc.getMinimalInternalModel returnes the state space model myOde which is an
%misc.ss.Odes object and represents an internal model based on the signal model
%dynamics defined by S.
...
...
@@ -27,17 +27,23 @@ function [myOde, trackingSum, spectrumIndividual] = getMinimalInternalModel(...
% (default: 'internalModel')
%
% mySs = misc.getMinimalInternalModel(S, inputVectorMode, numberOfCopies, ...
% stateName, controlOutputName) the inputName-property of the resulting
% stateName will be set to controlOutputName (default: 'plant.controlOutput').
% stateName, internalModelInputName) the inputName-property of the resulting
% state space will be set to controlOutputName (default: 'trakcingError').
%
% mySs = misc.getMinimalInternalModel(S, inputVectorMode, numberOfCopies, ...
% stateName, internalModelInputName, outputSignalName, referenceSignalName)
% additional output of the internal model state space will be
% internalModelInputName = outputSignalName - referenceSignalName.
% The InputName are outputSignalName and referenceSignalName instead of internalModelInputName.
arguments
S
(:,
:)
double
;
inputVectorMode
(
1
,
1
)
string
=
"minimal"
;
numberOfCopies
(
1
,
1
)
double
=
1
;
stateName
string
=
"internalModel"
;
trackingErrorSignal
Name
string
=
"trackingError"
;
internalModelInput
Name
string
=
"trackingError"
;
outputSignalName
string
=
"controlOutput"
;
referenceSignalName
string
=
"reference"
;
referenceSignalName
string
=
string
()
;
end
% arguments
% Smin: find minimal representation of S
...
...
@@ -65,13 +71,24 @@ end
mySs
=
ss
(
sMin
,
B
,
eye
(
size
(
sMin
)),
[]);
mySs
=
misc
.
ss
.
setSignalName
(
mySs
,
"output"
,
stateName
,
size
(
mySs
.
C
,
1
));
mySs
=
misc
.
ss
.
setSignalName
(
mySs
,
"input"
,
trackingErrorSignalName
,
size
(
mySs
.
B
,
2
));
if
strlength
(
referenceSignalName
)
>
0
% implement tracking error via sum
% internalModelInputName = outputSignalName - referenceSignalName
mySs
=
misc
.
ss
.
setSignalName
(
mySs
,
"input"
,
internalModelInputName
,
size
(
mySs
.
B
,
2
));
% get sum to create tracking error signal in simulation, i.e. a sum block:
trackingSum
=
sumblk
(
char
(
internalModelInputName
+
...
"="
+
outputSignalName
+
"-"
+
referenceSignalName
),
...
numberOfCopies
);
mySs
=
misc
.
ss
.
connect
(
trackingSum
.
InputName
,
[
trackingSum
.
OutputName
;
mySs
.
OutputName
],
mySs
,
trackingSum
);
else
% feed internal model via outputSignalName
mySs
=
misc
.
ss
.
setSignalName
(
mySs
,
"input"
,
internalModelInputName
,
size
(
mySs
.
B
,
2
));
end
myOde
=
misc
.
ss
.
Odes
(
mySs
,
stateName
);
% get sum to create tracking error signal in simulation, i.e. a sum block:
trackingSum
=
sumblk
(
char
(
trackingErrorSignalName
+
...
"="
+
outputSignalName
+
"-"
+
referenceSignalName
),
...
numberOfCopies
);
end
% getMinimalInternalModel()
function
[
sMin
,
lengthBlocks
]
=
minimalDynamicMatrix
(
S
)
...
...
+unittests/+misc/testMultArray.m
View file @
69c55e12
...
...
@@ -162,35 +162,3 @@ BC = B*C;
testCase
.
verifyTrue
(
numeric
.
near
(
bc
,
BC
.
on
()));
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment