LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically decreasing the frequency of a sinwave in a While loop, at a set timing.

Hi,

 

I am quite new on labview, I just started to use it roughly a month ago.

 

I am trying to simulate impedance measurement (not connected to any load units yet).

 

I am struggling to find a proper way to change the frequency of the sinwave, after a certain length of time, to make it describe a full spectra of frequency. I don't want to change it at every iteration, but like every 80 seconds, after the start/stop button has been pressed.

 

To be more clear, I want to set a Max frequency, a Min frequency, and have the program dividing the frequencies by two (10000, 5000, 2500... Assuming the Max is 10000 for example) every 80 seconds. And stopping at the min frequency.

 

Here is the vi attached.

 

If you think of better way to run my .vi, please let me know.

 

Kentmey.

 

Kentmey
0 Kudos
Message 1 of 5
(2,545 Views)

The frequency is set by the 'w' parameters in your sine wave function.

 

So basically, you want a function that reads in the current time and outputs a frequency value starting at 10000 and decreasing by 50% every 80 seconds.

 

Here is a simple VI that will do exactly that.  It takes the data from Elapsed time (s) and delivers a frequency to w. 

 

Right now, it's set to start at 10,000 but you can wire Fmax instead. 

0 Kudos
Message 2 of 5
(2,530 Views)

I couldn't resist the urge to clean up the rest of it.

 

 

0 Kudos
Message 3 of 5
(2,526 Views)

Thanks a lot, it looks a lot nicer. Massively better (And a lot faster than mine as well).

Kentmey
0 Kudos
Message 4 of 5
(2,524 Views)

The increase in speed is probably because your program wrote data to the file with each iteration, while my version waits for it to complete (either Stop button or F<Fmin) and then saves all the data at once.

 

 

0 Kudos
Message 5 of 5
(2,520 Views)