Signal Generators

cancel
Showing results for 
Search instead for 
Did you mean: 

Shift phase on the fly in 5422

Hello guys!

Can anyone tell me or give an example?
How in 5422 to change the phase of the signal on the fly?

Don't with to restart, namely on the fly, may be using a Trigger or Property Node, as in example - the amplitude and frequency.

And more, property - the Start Phase in Property Node, used only to set the initial phase and can't be used for shift phase on the fly?

Best regards, Max.

 

Engineer and software developer,

TeSLa.

 

Download All
0 Kudos
Message 1 of 29
(7,610 Views)

Hi Max,

 

There is an example, Fgen 5404 Synchronization.vi (found in LabVIEW's NI Example Finder), that sends two synchronized outputs from our function generators which includes the capability you are looking for.  This should apply to your 5422 as well.

 

In this example, the slave output device can have its phase adjusted on the fly by writing to the Start Phase value in a Property Node and then resending a start trigger to commit the new phase information to the device (no trigger need be sent when in Immediate Mode).  This does not completely restart the device, but a glitch will be apparent as the phase shifts in the output.

 

This is the best performance you can get from an arbitrary waveform generator as they are not specifically designed to do this sort of on-the-fly phase shifting.  Generally for phase shifting, one would use an I/Q modulator, such as the PXIe-5450, which takes advantage of the simplicity in adjusting the amplitude of two orthogonal sinusoids to produce a desired phase in an one's output.

 

Regards,

Regards,
Chris Elliott
x36772
0 Kudos
Message 2 of 29
(7,579 Views)

Generally for phase shifting, one would use an I/Q modulator, such as the PXIe-5450, which takes advantage of the simplicity in adjusting the amplitude of two orthogonal sinusoids to produce a desired phase in an one's output.

 

Or the simpler, more inexpensive option: A function generator such as the NI 5402 and NI 5406

Marcos Kirsch
Chief Software Engineer
NI Driver Software
0 Kudos
Message 3 of 29
(7,576 Views)

Thanks guys for the help!

 

What it means: "in Immediate Mode" (code on the block diagram)?

It is Case Structure with Property Node?

 

Engineer and software developer,
TeSLa.

0 Kudos
Message 4 of 29
(7,550 Views)

In the example, after the change in the code - the configuration in Standard mode, does not occur shift phase on the slave devise.

What could be the reasons?

 

Engineer and software developer,
TeSLa.

0 Kudos
Message 5 of 29
(7,522 Views)

Hi Max,

 

To answer your first question regarding immediate mode, this simply refers to using the device without any triggering (e.g. device starts once it is initialized).

 

To your second post - I'm afraid I'll need some more information as far as what is going wrong with your phase shifting (or lack thereof).  I ran your posted code on a test machine here using two function generators plugged into one of our scopes for checking the behavior and this is what I saw:

 

0* phase offset:

 

0 degrees.png

 

 

90* phase offest:

 

90 degrees.png

 

 

180* phase offset:

 

180 degrees.png

 

 

How is your signal different from this? Can you post a similar screenshot?

 

Keep in mind that the 5422, as I mentioned before, is not ideal for phase shifting so your signal outputs may not be as clean as mine.  Unfortunately, I do not have a 5422 available so I am unable to replicate your setup exactly, but you should see somewhat comparable results.

 

Regards,

Regards,
Chris Elliott
x36772
0 Kudos
Message 6 of 29
(7,510 Views)

Hi Chris.

 

I don't watch the change phase in the control of Phase Adjust element.

But both signals are run a synchronously.

Here's a screenshot:

 

0*  phase offset

0 deg.png

 

180*  phase offset

180 deg.png

 

A similar picture is observed as 5922, and in 5122.
I use the 1042 chassis with the controller 8108.

And LabVIEW 2011 with NI-FGEN 2.9, NI-SCOPE 3.8.7 drivers.

 

Engineer and software developer,
TeSLa.

 

0 Kudos
Message 7 of 29
(7,496 Views)

Hi Max,

 

What do you mean by "both channels are run a synchronously"?  The example VI you posted earlier had both devices synchronized.  Have you made a change to the code since you last posted it?  I do only see one channel displayed in your Scope Soft Front Panel though both boxes are checked for channels 1 and 2; are both channels physically connected to your scope?  Generally even with two in-phase signals, you should still be able to see two distinct traces on your scope.

 

If you are only reading the signal whose phase you are shifting, this is expected behavior.  Because your Scope Soft Front Panel is set to trigger on an edge of your acquired signal, the acquisition will trigger at the same part of the sinusoid's slope regardless of the phase you select, effectively shifting your acquisition window in a way such that the sinusoid will always be centered in your captured data.  You need to trigger off of a reference source that does not change phase so that you can see your phase-shifted signal move with respect to your phase-constant reference.

 

Regards,

Regards,
Chris Elliott
x36772
0 Kudos
Message 8 of 29
(7,483 Views)

Hi Chris!

 

You right, I mean - the both devices are run a synchronized.
I don't change the code since my last posted it.
Both channels physically connected to one scope.
I correctly understand?
The reference source that does not change phase - the Device 1, the source with changing phase - the Device 2 (in this example).
But there are no changes!

 

Engineer and software developer,
TeSLa.

0 Kudos
Message 9 of 29
(7,479 Views)

Hi Max,

 

I apologize this is not working for you.  I was able to get ahold of a 5422 today and I reproduced your issue where the phase would not change.  Looking into this further, I have found that the 5422 is not capable of implementing the property node Start Phase while the device is running.  However, I have found another way to implement this functionality.

 

Using script output mode, you can have two independent output buffers on the 5422, say waveform1 and waveform2, given x sample points for one complete 360* cycle at S sampling rate; frequency, f = S / x.  Whilst outputting waveform1, you can shift your phase of waveform2 by rotating the array of data points from waveform1 by n, where

 

n = floor ( p * ( x / 360) ), where p is your phase shift in degrees and n is the number of elements by which you rotate

 

Write waveform1 rotated by n to waveform2 and switch your output to waveform2.  The following script will configure the 5422 to do this:

 

script SwitchWaveforms
   repeat forever
      repeat until scriptTrigger0
         generate Waveform1
      end repeat
      repeat until scriptTrigger0
         generate Waveform2
      end repeat
   end repeat
end script

 

This will effectively change your phase on the fly.  I was able to get this working with some crude code on my test machine here and confirmed this to work with the 5422.

 

I will be putting this together and posting it as a Community Example in the coming days when I have some time to clean up the code and document it for public consumption.  In the meantime, you may start with the example in LabVIEW titled Fgen Switch Between Waveforms and play with rotating the 1D Double array that is input into niFgen Write Named Waveform (DBL).vi in the main loop.  As before, be sure to have a second waveform for phase reference.  I would recommend PLL'ing to the PXI_CLK10 reference clock as in the code you have been using so that your two outputs don't drift from one another.

 

Please let me know if you still need assistance on this, but this should get you up and running.

 

Regards,

Regards,
Chris Elliott
x36772
0 Kudos
Message 10 of 29
(7,470 Views)