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
  • Index
  • » Users
  • » r.trevor.clark
  • » Profile

Posts

Posts

Feb-12-16 04:14:28
store all samples in a vector for use during the simulation.
Category: Programming

I think I solved my problem. Thanks.

Feb-11-16 16:12:22
store all samples in a vector for use during the simulation.
Category: Programming

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
  • » Users
  • » r.trevor.clark
  • » Profile
You are here: