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

Is there a length limitation on vectors?

Is there a length limitation on vectors?

Hello,
I am trying to implement a simple sinc filter for a model I am working on. The following code works for n<=19 but for higher orders it fails:

Code:

block SyncFilter

  parameter Real UpdateRate = 25000.0;
  parameter Integer n = 5;
  extends Modelica.Blocks.Interfaces.DiscreteSISO(samplePeriod = 1.0 / (n * UpdateRate));
  output Real x[n - 1] "State of transfer function from controller canonical form";
 
  Real b[n] = ones(n) / (1.0 * n);
  Real xext[n];
  Real x1;
 
equation
  when sampleTrigger then
      x1 = u;
    xext = vector([x1;x]);
    x = xext[1:size(x, 1)];
    y = vector([b]) * xext;
 
  end when;
end SyncFilter;

With n=20, I get the following error:

Code:

"Error: Wrong type or wrong number of arguments to vector([b])'.

Any Thoughts?

Edited by: hvontres - Jun-07-10 19:38:16

Re: Is there a length limitation on vectors?

We fixed quite some bugs recently and it seems this started to work in OpenModelica.
I added a test for it so we don't break it again current/smile
http://openmodelica.org/svn/OpenModelic … cFilter.mo
http://openmodelica.org/svn/OpenModelic … Filter.mos
user: anonymous, pass: none    <- write none here.

You can download the latest nightly-build from here:
http://build.openmodelica.org/omc/builds/windows/

Cheers,
Adrian Pop/

There are 0 guests and 0 other users also viewing this topic
You are here: