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
  • » Moebo
  • » Profile

Posts

Posts

Hi there,

unfortunately I don't have a solution to the problem, I just experienced the same issues as you guys.

So I decided to implement a DFT on my own and I think I may found the issue of the realFFT example.

Have a look at the following basic example I implemented:

Code:


block DFT
  import Modelica.Constants.pi;

  parameter Integer N = 360 "Total number of samples";
 
  Integer iTick;//(start=0, fixed=true);
  Real y_buf[N];//(start=vector([6.5; fill(0, N - 1)]),each fixed=true);
 

algorithm

when sample(0, 0.1) then     
  iTick :=iTick + 1;
 
  if iTick >= 1 and iTick <= N then
    y_buf[iTick] := iTick;
  end if;
end when;

end DFT;

I copied some parts of the realFFT example to sample a simple sine function but it didn't work! No values were written into the y_buf array.
So tried to simply assign the value of "iTick" to the buffer array but it still doesn't work..

My guess is that it has something to do with the when environment together with the sample() function because the following example works fine:

Code:


block DFT
  import Modelica.Constants.pi;

  parameter Integer N = 360 "Total number of samples";
 
  //Integer iTick;//(start=0, fixed=true);
  Real y_buf[N];//(start=vector([6.5; fill(0, N - 1)]),each fixed=true);
 

algorithm

for i in 1:N loop
y_buf[i] := i;
end for;

end DFT;

So if anyone has an idea why the first example doesn't work but the second does it would be a great help for my work!

Hopefully I can contribute with this post to motivate the discussion about these issues.

  • Index
  • » Users
  • » Moebo
  • » Profile
You are here: