How to analyze SPS simulation results 📊 - Review

Once your SPS model is built and running, the next crucial step is analyzing the results. SPS provides powerful tools for both steady-state evaluation and frequency-domain analysis.

Here is a guide on how to identify your state variables, find steady-state values, and plot impedance versus frequency.


:magnifying_glass_tilted_left: 1. Understanding Electrical State Variables

Before analyzing, it is important to know how SPS handles state variables. The electrical states in your circuit consist of inductor currents and capacitor voltages.

When looking at system outputs or state-space matrices, you can identify them by their prefixes:

  • Il_ : Used for inductor currents.
  • Uc_ : Used for capacitor voltages.

:balance_scale: 2. Steady-State Analysis (The GUI Method)

To quickly check the steady-state voltages and currents of your circuit before a transient event occurs:

  1. Double-click the powergui block.
  2. Open the Steady-State Voltages and Currents Tool.
  3. This tool displays the steady-state phasors (magnitude and phase) measured by your voltage and current measurement blocks.
    Note: The magnitude shown corresponds to the peak value of the sinusoidal waveform.

:chart_increasing: 3. Frequency Analysis (Impedance vs. Frequency)

Finding resonance points and analyzing the frequency response of a network is a common task. There are two ways to measure impedance in SPS:

Method A: Using the Impedance Measurement Block (Easy)

  1. Add an Impedance Measurement block from the SPS > Sensors and Measurements library and connect it across the nodes you want to measure.
  2. Open the powergui block and go to the Tools tab.
  3. Select Impedance Measurement.
  4. Enter your desired frequency range (e.g., 0:2:5000 for 0 to 5000 Hz in steps of 2 Hz) and click Update.
  5. The tool will automatically plot the Impedance magnitude and phase!

Method B: Using the State-Space Model & MATLAB Commands (Advanced)

If you prefer scripting or need to automate your analysis, you can extract the state-space model using the power_analyze command and plot it using the Control System Toolbox.

To do this, you first need to inject a signal. Connect an AC Current Source (with 0 amplitude) at the node you want to measure, and measure the voltage across it.

Then, run this MATLAB script:

% 1. Extract the state-space model of the circuit
sys1 = power_analyze('power_gui', 'ss');

% Note: You can check your input and output names to find the right indices
% sys1.InputName   (Look for your AC Current Source)
% sys1.OutputName  (Look for your Voltage Measurement)

% 2. Define the frequency range (0 to 5000 Hz)
freq = 0:5000;
w = 2 * pi * freq;

% 3. Plot the Bode diagram
% Assuming the voltage measurement is Output 1 and the current source is Input 2
bode(sys1(1,2), w);

:light_bulb: Pro-Tip: The command-line method is incredibly powerful if you are comparing different circuit configurations (like a single PI line section vs. a 10-section PI line). You can extract multiple state-space models and plot them on the same Bode diagram to see exactly where a simplified model loses high-frequency accuracy!