Overlaying reference harmonics onto the Scope FFT display

Hi all.

I would like to use PLECS to plot the current harmonics of a number of different circuit topologies. For each simulation I would also like to overlay the measured harmonics with some reference harmonics limits that I don’t want them to exceed, so that I can easily spot if any of the harmonics magnitudes exceeds the limit for that harmonic. These limits are basically pre-defined fixed percentages of the fundamental frequency that reduce with frequency.

I am familiar with using the Fourier Spectrum feature of the scope and use of the different PLECS blocks.

Is there a neat and simple way to do this? Is there some script command I can use to just write values to the scope Fourier Spectrum? I have not found one in the manual. Or is the best way a matter of creating a sub-system template block to reuse across each circuit topology that outputs the exact harmonic limits I want for a multi-plot scope to then read and plot beside the measured harmonics?

Currently the Fourier Analysis feature of the PLECS Scope is not accessible via simulation scripts.

One approach to access the Fourier spectrum in simulation is to use the Fourier Transform block from the PLECS library. The output of the Fourier Transform block can then be accessed via a simulation script using a Signal Outport on the top level schematic. Then, one can iterate through different configurations in a Configurable Subsystem to evaluate different topologies. Additionally, as of PLECS 4.4 users have the ability to generate Octave plots from PLECS simulation scripts.

Attached is an example model. The model includes a script to generate the figure below. The script is accessible from the Simulation + Simulation Scripts drop-down menu. In this case the harmonics waveforms are generated as a sum of sinusoids, but naturally this can be expanded upon.

Alternatively, you could use a similar script and the To File block from the PLECS library and post process the data in another tool.

example_fourier_comparsion_and_limit_line.plecs (19.7 KB)

Thanks, much appreciated. I believe this answers my question. :slight_smile: