top of page
Writer's pictureLMS RS

How to Measure Total Harmonic Distortion (THD) of Voltage and Current in MATLAB

Setting Up the Three-Phase System

To start, we need a three-phase voltage source. In this case, we'll be using a three-phase voltage source and connecting it to a Universal Bridge (also known as a rectifier). The rectifier will help us create a non-linear load, which is necessary for measuring harmonic distortion.

For the load, we'll use a diode-based rectifier connected to an RLC (Resistor-Inductor-Capacitor) filter branch. It's worth noting that for this tutorial, we'll be using the default values provided by MATLAB for the RLC branch, without any custom design.

Creating the Circuit in MATLAB

Once the components are in place, the next step is to simulate the system in MATLAB. You'll want to:

  • Connect the three-phase voltage source to the Universal Bridge (rectifier).

  • Add the RLC branch for filtering, and use the default resistor values.

  • Set up a resistive load to simplify the circuit.

With this basic setup, we now have a working circuit that generates both voltage and current waveforms.

Storing Voltage and Current Data

After setting up the circuit, you need to store the generated voltage and current waveforms for later analysis. To do this, MATLAB allows you to save variables to the workspace.

Here’s how:

  1. Voltage Data: Connect a voltage measurement block to the system and name it "VG" in the workspace.

  2. Current Data: Similarly, measure the current and name it "IG" for easy identification.

  3. Scope Visualization: Use the scope tool to visualize the waveforms of both the voltage and current. You can connect two separate scope channels—one for voltage and the other for current.

These values will now be available in the MATLAB workspace, where you can access them for further analysis.

Simulating the Circuit

Once everything is set up and data is being logged, run the simulation in MATLAB. During this step, the software will process the model using the three-phase voltage source, the rectifier, and the RLC filter branch, outputting voltage and current data.

The result of this simulation will show the waveforms of both voltage and current. These can be analyzed further to check for harmonic distortions. You can store the output data in the workspace automatically by enabling the logging feature in the scope properties.

Performing Total Harmonic Distortion (THD) Analysis

Now, we can start the actual THD analysis. Here's how to proceed:

  1. Access Workspace Data: Go to MATLAB's main window and access the variables "VG" (voltage) and "IG" (current) that were stored earlier.

  2. Setting Analysis Parameters: Define the analysis parameters, such as the number of cycles to analyze (typically 1 cycle) and the frequency (set to 60 Hz for standard AC power systems).

  3. Frequency Range: Set the maximum frequency for analysis (e.g., 2500 Hz). MATLAB will then analyze the signal for harmonic components within this frequency range.

  4. Display Options: You can choose to display the results in two different formats:

    • Frequency axis: Shows the distortion across frequencies.

    • Harmonic order axis: Displays the distortion in terms of harmonic order, which is useful for identifying specific harmonics.

Interpreting the THD Results

Once the simulation and analysis are complete, MATLAB will display the THD results. For example, you might see that the THD for the grid current is around 28.75%, while the THD for the voltage might be around 22.84%. These values indicate the level of harmonic distortion present in the system.

Advanced Visualization and Analysis

MATLAB provides additional tools for refining your analysis. By switching between the frequency and harmonic order views, you can get different perspectives on how harmonics are distributed across the signal. The frequency view will show you the distortion in terms of specific frequencies, while the harmonic order view helps you understand the harmonic content more intuitively in terms of order (1st harmonic, 2nd harmonic, etc.).

You can also visualize the data using the scope tool, which allows you to see real-time waveform data, making it easier to identify where distortion occurs.

Conclusion

In this tutorial, we’ve learned how to measure Total Harmonic Distortion (THD) in voltage and current using MATLAB. By setting up a three-phase system, simulating the circuit, and performing THD analysis, we can evaluate the harmonic content of the power system. MATLAB’s powerful tools, such as the workspace, scope tool, and harmonic analysis functions, make this process straightforward and efficient.

6 views0 comments

Комментарии


bottom of page