- Index
- » Programming
- » Modelica Language
- » Sample continuous variables for least...
Sample continuous variables for least squares estimation
Sample continuous variables for least squares estimation
I am trying to model an adaptive controller in modelica. I want to sample variables at discrete time instances, I think this works just fine with the sample command. In addition I want to keep an array of each sample to do least squares estimation. currently in my model it is setup like this:
parameter h = 0.5;
Real uc, y, step;
Real yk[1000], uck[1000];
when sample(0,h) then
yk[step] := y;
uck[step] := uc;
step = step +1;
end when;
The simulation compiles, However this makes it difficult for the solver to converge. Is there a good way to sample a continuous variable and hold all the samples in an array?
When I try to simulate I get a big long list of errors like:
Warning: The linear system:
1 : $PRE.yk[323] = yk[323]
2 : yk[323] = $PRE.yk[323]
[
-1.0 , 1.0 ;
1.0 , -1.0
]
*
[
yk[323] ;
$PRE.yk[323]
]
=
[
0.0 ;
0.0
]
might be structurally or numerically singular for variable $PRE.yk[323] since U(2,2) = 0.0. It might be hard to solve. Compilation continues anyway.
- Index
- » Programming
- » Modelica Language
- » Sample continuous variables for least...