LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looping/cycling through frequencies with the create signal VI

Solved!
Go to solution

Hi,

 

I am trying to actuate a PZT with a given signal (from a formula) and record the output from sensors. I am using a NI PXI 5421 to generate the signal and a NI PXI 5105 to record the signals. I have made the attached code which works well however I would like to be able to loop the frequency and number of samples (the number of samples is a function of the frequency) in the create signal VI so that I can sweep through a range of frequencies. Could you please help me. I can't seem to figure out how to control the frequency aside from editing it in the properties window.

 

Thanks,

Casey

 

0 Kudos
Message 1 of 6
(2,661 Views)

Hi Casey,

 

It looks like the Create Signal VI you are using to create your signal from a given function is an express VI. Express VIs are good for basic functionality, but will not provide the flexibility to go beyond the parameters that you can configure in the configuration dialog window. The solution would be to stop relying on the express VI, and instead make use of the Formula Waveform.VI, which is a lower level VI. With the Forumla Waveform VI, you have access to the frequency, formula, and other inputs, allowing you to modify any of these input parameters on the fly as you wish.

 

You can find the Formula Waveform VI by going through: Signal Processing » Waveform Generation. I was able to discover this solution by poking around in the Waveform Generation palette myself until I stumbled upon the Formula Waveform VI, which happened to look like a lower-level version of the Create Signal express VI.

Sanjay C.
Embedded Software Product Manager| National Instruments
0 Kudos
Message 2 of 6
(2,620 Views)

Hi Sanjay,

 

Thanks a lot, that solved that problem. Unfortunately I seem to be having another problem.

 

I'm having trouble acquiring signals when I put everything into a for loop to implement the frequency sweep. It seems like the 'NI Scope Express' acquires signals at random times rather than when it is supposed to. I have played around extensively with the trigger settings but cannot seem to get it to acquire a signal when I need it to. I have included my program in the attached VI: 'full sweep.vi'. This is very confusing to me because I have been able to acquire a signal repeatedly and consistently when I have 'NI Scope Express' in a while loop as in the attached file 'Lamb Wave Sweep.vi' with the same trigger settings.

 

Can you please help me with this?

 

Thanks,

Casey

Download All
0 Kudos
Message 3 of 6
(2,605 Views)

Hi Casey,

 

I don't have hardware to test this out on, but I have two theories, which you can look into further:

1. The timing of the for loop has changed and is slower, and so the reading from the NI-SCOPE express VI is now choppy. The fix here would be to move the NI-SCOPE read into a separate loop. Is there any reason why it's in the same loop to begin with?

 

2. Since you are doing a loopback here, can you ensure that the output from the FGEN is what you expect it to be? It may be that the actual output might be at fault. Does the Actuation Signal Waveform Graph look correct? Can you verify the output with an oscilloscope by any chance?

 

Following up on the two items above will help isolate this new issue that you are now facing. Keep us posted on the status of the issue.

Sanjay C.
Embedded Software Product Manager| National Instruments
0 Kudos
Message 4 of 6
(2,593 Views)
Solution
Accepted by topic author ckeulen

Thanks Sanjay,

 

I just figured it out. I redid the vi and when I ran it an error came up that said the input signal needed to be an integer value of a multiple of 4. I made a few simple changes to do that and after that everything worked as expected. I guess the waveform input looked ok but did not get actuated by the hardware unless it was a multiple of 4.

 

Thanks for your help,

Casey

 

0 Kudos
Message 5 of 6
(2,582 Views)

Hi Casey,

 

Glad you were able to narrow it down and solve the issue! Best of luck going forward with the application.

Sanjay C.
Embedded Software Product Manager| National Instruments
0 Kudos
Message 6 of 6
(2,569 Views)