Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Scripting: export FFT between Scope cursors

0 votes
416 views
Hi,

I'm doing some scripting in Standalone. After each simulation iteration I set the cursors of a scope to the last 10 periods of a periodic signal, I'm exporting rms, max, min values as well as the bitmap of the scope. Now I would like to export also the Fourier amplitudes of the last 1 period and store the values in a file. Is this possible with scripting?
asked May 6 by bkofler (14 points)

1 Answer

0 votes
It is not possible to access the FFT in the PLECS Scope via the PLECS scripting interfaces. For the moment, the only solutions are to perform the FFT analysis using the ‘Fourier Transform’ block or to export the signal that should be analyzed, and perform the FFT analysis in post processing.

The Octave distribution with PLECS standalone includes the fft() function.  Attached is a simple example where the PLECS simulation results are post processed using Octave.   Note the return of values of the fft() function require some manipulation to return the single sided amplitude spectrum that is shown in the PLECS Scope.
answered May 7 by Bryan Lieblick (2,045 points)
edited May 7 by Bryan Lieblick
Thanks a lot for the fast reply and the example.

I think I'll try your proposal with post processing using Octave. In fact I found two important things in your example:

1) How to set up regularly sampled output data

2) FFT post processing

The control system in my simulation takes some time to reach steady state. I have to understand now, how to export exactly one complete period in steady state at the end of the simulation as input vector for the fft post processing.
...