Determining Phase Mismatch Between Two Channels in LabVIEW, LabWindows/CVI, and SignalExpress

Updated Dec 22, 2023

Environment

Software

  • LabVIEW Full
  • LabVIEW Professional
  • SignalExpress
  • LabVIEW Electrical Power Toolkit Full
  • LabWindows/CVI

I have two synchronized analog input channels and I want to know the phase shift from one channel to the other.  Is there a way to easily determine the phase difference or mismatch in LabVIEW, LabWindows, and/or SignalExpress?

LabVIEW Implementation
You can use the VIs available in the Full and Professional versions of LabVIEW to perform a phase mismatch measurement.

For finding the phase shift between two sine waves, use the Extract Single Tone Information VI. Calculate the phase shift by taking the difference of the two as seen in Figure 1.

Figure 1. LabVIEW code for finding phase difference between two sine waves.

To find the phase shift between two square waves, use the Pulse Measurements VI. This VI determines the pulse center and pulse duration of each wave.  Once you have this information, you can calculate the phase shift between the two waves as shown in Figure 2.

Figure 2.  LabVIEW code for finding phase difference between two square waves

Another method for calculating the phase difference using LabVIEW is to use the Phasor VI from the Electrical Power Measurement Palette .


LabWindows/CVI Implementation
You can use the LabWindows/CVI functions equivalent to the VIs mentioned above and use the same methodology described above to achieve the same functionality in LabWindows/CVI. The LabWindows/CVI equivalent functions are the following: 

  • SingleToneInfo - Equivalent to the Extract Single Tone Information VI.
  • PulseMeas - Equivalent to the Pulse Measurements VI.

SignalExpress Implementation
In SignalExpress create a Tone Extraction step to determine the phase value for each channel. A Formula step will be added to subtract the two phases as in Figure 3 (the SignalExpress Tone Extraction Step is built using the Extract Single Tone Information VI available in LabVIEW).



Figure 3. Signal Express steps required to determine phase difference.

You need to configure the Formula step as shown in Figure 4.



Figure 4. Configuration of Formula step for calculating phase difference.