Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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.

Edited by: r.trevor.clark - Feb-11-16 16:36:29

Re: Sample continuous variables for least squares estimation

I think I solved my problem. Thanks.

Edited by: r.trevor.clark - Feb-24-16 05:08:22
There are 0 guests and 0 other users also viewing this topic
You are here: