From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

Swept sine measurement phase shift problem

Solved!
Go to solution

Hello all,

 

I'm performing a simple measurement: I measure frequency response using swept sine VI from sound and vibration package. I simply wire output signal to two input terminals (stimulus and response chanels) - so I should get frequency response magnitude equal to "1" at all frequencies and phase equal to "0" at all frequencies. However due to the fact that my PCI card (PCI 6251) is not able to record data simlutaneously, there is a phase shift which rises linearly with frequency. Is there a simple way to correct this?

 

thanks!

martin

0 Kudos
Message 1 of 14
(11,850 Views)
Solution
Accepted by topic author sumac

You can customize the interchannel delay in DAQmx by setting the AI Convert Clock Rate. http://digital.ni.com/public.nsf/allkb/65E7445DB1AA5DC586256A410058697B?OpenDocument&nisrc=LV-2012

 

Simultaneous sampling devices such as Dynamic Signal Acquisition devices should be used to guarantee (in hardware) simultaneous sampling.

 

If you are satisfied that the current hardware configuration is optimal for your application, you can compensate the Swept Sine phase output using the Sound and Vibration function:

SVFA Compensate Phase for Time Delay (XY) (1 Ch).vi

Compensate Phase Spectrum for Time Delay.png

Doug
NI Sound and Vibration
Message 2 of 14
(11,847 Views)

Great!

 

thank you very much!

martin

 

0 Kudos
Message 3 of 14
(11,836 Views)

How would you exactly implement this in a swept sine VI?

 

Thanks,

0 Kudos
Message 4 of 14
(7,969 Views)

Use the same code snippet shown above. If you wire XY data (where X is the array of frequencies and Y is the array of phase lags) produced by swept sine to it, the polymorphic VI will automatically adapt. You must input the channel delay for each phase response. If you are asking how one could measure the delay to use for compensation. The delay may be known from a previous measurement, model, or an inline measurement using a VI such as SV Measure Delay VI.

 

Give it a try, and post your code.

Doug
NI Sound and Vibration
0 Kudos
Message 5 of 14
(7,958 Views)

capture3.PNG

This is part of the block diagram I have. I got the VI from online and after FRF, the output phase consists of an array of phase and corresponding frequency. I tried adding the delay block but it says it requires a spectrum. 

capture4.PNG

This is inside of the FRF block. I felt like I was supposed to add a delay block here. The swept sine task in has the source setting, stimulus setting and response setting. The output of the frf block is the bode plot of magnitude and the phase. Is there any clue as to how I can implement the delay?

 

Also, in the initialize block VI, the response and the stimulus data has clusters of 9 elements from 0 to 8. Would you be able to explain why there are 9 elements?

 

Thank you!

Stephen

 

0 Kudos
Message 6 of 14
(7,951 Views)

Don't add the delay compensation inside the FRF block as that would modify the SV API VI. If you update to a newer version of Sound and Vibration, it will overwrite your change.

 

Your first screenshot in the above post looks correct. You are almost there; into SVFA Compensate Phase for Time Delay wire a spectrum info constant input that corresponds to the FRF phase. You can refer to snippet above or screenshot of constant below. Key parameters are the x-axis units and compliementary spectrum units. Set x-axis units to 'Frequency-CB (Hz)' and complimentary spectrum units to 'degrees'.

SpectrumInfo.png

Doug
NI Sound and Vibration
0 Kudos
Message 7 of 14
(7,926 Views)

Thank you! One last question though

 

It seems like the SVFA Compensate Phase for Time Delay block is multiplying the delay by 360 and the frequency and adding it to the phase. This seems to make the phase plot to just increase. The plot below is the phase response of a simple RC low pass filter circuit. Any suggestions as how to fix the angle issue?

 

capture5.PNG

 

Regards,

Stephen

0 Kudos
Message 8 of 14
(7,920 Views)

It looks like you input a delay ~1. That is a lot of delay. First, evaluate the phase response without phase compensation, and then estimate the delay. 

 

delay = Phi_fmax / (fmax * 360)

 

Then, input that negated delay into the phase compensation VI. One could argue the naming of the VI, but positive delay leads to addition of phase; negative delay leads to subtraction of phase from the input phase spectrum.

Doug
NI Sound and Vibration
0 Kudos
Message 9 of 14
(7,915 Views)

Here is some data taken with 4461 where the technique mentioned above was used to flatten the phase response.

Phase Before and After Compensation.png

Doug
NI Sound and Vibration
0 Kudos
Message 10 of 14
(7,914 Views)