How to observe the perturbation signal when using Frequency Response analysis?

Hi,

Just like the title, how to evaluate the perturbation signal when performance frequency response analysis?

I tried putting scope on the perturbation source and nothing. I need to know the detail signal in my Sims at different nodes during FRA to debug why I don’t get the result I expect.

Thanks

Arief

Hi Arief,

The behavior you are observing is expected. The Small Signal Perturbation block is not an ordinary sine-wave source. Its output is zero during a normal transient simulation and it is activated internally only while the selected Frequency Response Analysis is running.

For each analysis frequency, PLECS runs a separate transient simulation with the configured sinusoidal perturbation, as well as an additional unperturbed simulation with zero perturbation amplitude. PLECS then subtracts the Fourier components of the unperturbed run from the corresponding components of the perturbed run and calculates the frequency response from the resulting differences.

These simulations are distributed across the available processor cores and executed in parallel. A regular Scope does not combine the results from all threads. Instead, after the analysis, the Scope contains the transient result from one of the simulations executed in parallel. It may be the unperturbed simulation, which would explain why the perturbation signal shown in the Scope is zero. The final Bode plot is nevertheless constructed from the extracted results of all the individual simulations.

The attached bode_example.plecs model demonstrates this behavior. It contains a first-order low-pass filter with a corner frequency of 1 kHz. At 2 kHz, its expected response is approximately −7.0 dB and −63.4°.

The example contains two configured analyses:

  • Frequency Response performs the normal sweep from 5 Hz to 50 kHz. It calculates 21 logarithmically distributed frequency points, as well as an additional point at exact 2 kHz.
  • Single Frequency Detail performs the analysis only at 2 kHz. This is useful for inspecting the perturbation and response waveforms at a particular frequency with a regular Scope. The Scope display shown in the figure contains both the 30 kHz signal from the Sine Wave source and the injected 2 kHz signal from the Perturbation source.

Markers and Cursors

Markers and cursors are useful for examining the calculated Bode plot results. To display the individual data points, right-click a Bode plot curve, select Edit Curve Properties, and enable markers. This makes all 22 points visible in the normal Frequency Response Analysis and reveals the single data point in the Single Frequency analysis. You can then use the plot cursors to read the frequency, magnitude, and phase of each point.

Frequency Analysis Log

The Show log button in the Analysis Tools dialog provides additional information about the analysis. For every simulation, the log shows the perturbation frequency, simulation duration, perturbation amplitude, and thread number. It can also report diagnostic information about individual frequency points.

The log of the normal Frequency Response Analysis in the example includes the following diagnostic message:

The following 1/22 (4.55%) frequency responses are potentially inaccurate:
31547.9 Hz

In this example, the warning is related to the 30 kHz Sine Wave source. Because its frequency is close to 31.5479 kHz, spectral leakage can affect the Fourier extraction at this point. However, the sine-wave signal is deterministic and independent of the perturbation, so its contribution is largely removed when the unperturbed result is subtracted.

If the amplitude of the 30 kHz Sine Wave block is set to zero and the analysis is repeated, the response at 31.5479 kHz remains essentially unchanged. This confirms that the warning does not indicate a meaningful inaccuracy in this particular example.

The warning may be more relevant when the analysis perturbs the duty cycle of a PWM-controlled converter at a frequency close to its switching frequency. In such cases, several measures can improve the reliability of the frequency-response extraction at the frequencies identified in the warning. These include increasing the number of Extraction cycles, increasing the perturbation Amplitude while remaining within the small-signal range, or excluding known interfering frequencies from the analysis.

Further information is available in the PLECS documentation:

Best regards,
Johannes

Hi @Johannes_Bruderer

Thanks for the kind reply, now I understand. That idea to cancel the noise in FRA using unperturbed base sim is genius. I supposed thats how you can get down to -100dB noise floor even with very tiny perturbation magnitude.

Anyway, will you consider having another FRA analysis that just run on stepped frequency sweeping instead of running the analysis in parallel multi thread?

I did such analyzer in Qspice QSPICE/FRA_project at main · physicboy/QSPICE · GitHub
and I find it to be a lot easier to debug for controller saturation. It also make overall sim run faster for system with long steady state time (lets say digital control that includes complex startup and precharge procedure).

Cheers,
Arief,

Hi Arief,

Thank you for your reply and for sharing your repository. We will have a closer look at your FRA approach.

Regarding simulation time, the current PLECS approach does not repeat the complete startup procedure for every frequency. The Initialization time span, which may include a complex startup sequence, is simulated only once. The resulting system state is then used to initialize all perturbed and unperturbed simulations. As illustrated in the figure below, only the Settling time span and Extraction cycles are repeated for each frequency point.

If sequential execution is preferred, you can set Max. number of threads to 1. Each frequency point will then be processed sequentially, although every simulation still starts from the same initialized system state rather than continuing as one stepped-frequency transient simulation.

Another option is to start the analysis from a stored system state. First, run a transient simulation until the desired operating point is reached. Then open Simulation > Simulation parameters… > Initialization and, in the System Statesection, click Store current state…. Select Stored system state under Initialize from to use it for subsequent simulations and analyses. The analysis log will show the according information:

Initialize state and start time from the stored system state.

Best regards,
Johannes