LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a time delay between the start of one simulated signal and another?

Solved!
Go to solution

Hi,

 

To begin with, I'm fairly new to Labview.

I am trying to use Labview to output 2 different square waves (different frequencies, amplitudes, etc).  I set up 2 different Simulate Signals and have them in a While Loop, however, when I start running the program, I need one square wave to start immediately, and the other square wave to start 2 seconds later.  Any help would be greatly appreciated.

 

Thanks!

0 Kudos
Message 1 of 16
(6,941 Views)

If you have them in a While Loop, you are going to recreate square waves, over & over again..

 

How do you want the square waves to relate from one another?  Or are they two discretely different waveforms that are only related by the fact that they are created 2 seconds apart?  Any differences in shape, frequency, etc?

0 Kudos
Message 2 of 16
(6,936 Views)
Solution
Accepted by topic author seitelmark

A couple of questions.

Are these signals frequency related? If so do they have to be "in phase"?   As to starting one simulation after the other, put the one to start later in a case statement, pass into the loop a timer count to establish the initial start time, subtract its value from another within the loop, when the difference is => to 2 seconds set a true flag and have the second simulation in the true case of the case structure.

 

Typed too slow again!

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 16
(6,933 Views)

They are two discretely different waveforms and I only need them to be created 2 seconds apart from each other.  The square waves have different amplitudes and different duty cycles (the first has a duty cycle of 50%, the second has a duty cycle of 5%), and different frequencies (the first has a frequency of 0.05Hz and the second has a frequency of 0.2Hz).

 

If it helps, I attached a picture out what I want to output signals to look like with the corresponding time delay for the second signal.

0 Kudos
Message 4 of 16
(6,927 Views)

As Putnam suggested, I would create a State Machine which creates the first waveform based on its characteristics, take a timestamp, then the SM would go into a wait sate untile the delta in time is >= 2sec to then go into the state for the 2nd waveform.   That would be the easiest way tp go.

 

The more elegant method would be to share the same create waveform but pass it different characteristics and have a countdown state... 

Hummmm...  If the create waveform state runs fast enough, you could use a Wait Until ms Multiples and wire 2000 to it, but I should not recommend that..  It might spell trouble..

0 Kudos
Message 5 of 16
(6,920 Views)

Thank you so much for the help so far.  The Case Structure (True/False) works well.  The only issue that I am having now is using the DAQAssistant to output the signal to the physical BNC output connections.

I tried to use 1 DAQAssistant to receive the Generated Signals (the square waves) and I created 2 channels in the DAQAssistant (one for each of the Generated Signals).  I'm using the DAQAssistant to take the square waves and output them to a physical device.  I seem to get an error though when I do this, because the DAQAssistant seems to be expecting a signal from both channels as soon as the program begins; however, the signal with the 2 second delay obviously does not output a signal until 2 seconds after the start of the program.  As a result, I always get an error message.

If I try 2 DAQAssistants (one for each of the Generate Signals boxes), the second DAQAssistant (connected to the delayed square wave) always gives me an error, saying that it cannot activate, as the resources it requires are already being used by the first DAQAssistant (the one that is connected to the square wave without the delay).

Is there a way to output these signals?  I am outputting the square waves to two different physical channels, but I'm not sure what to do.  Any suggestions?

 

Thanks

0 Kudos
Message 6 of 16
(6,914 Views)

All of the previous suggestions with state machines/case statements/waits, do not apply to generating two signals with a DAQ card. What you need to do is make sure that both simulated waveform generator functions are using the same sample rate and number of samples. Then pad the front of the Y array of the delayed waveform with 2 seconds worth of samples and delete the same number of samples from the end of the array.

 

Posting via smartphone so I can't post any code. If you get stuck, I can do that later, though I would not use the DAQ Assistant. What version of LabVIEW?

Message 7 of 16
(6,900 Views)

It works!

Thanks everyone, for the help and suggestions!!

0 Kudos
Message 8 of 16
(6,896 Views)

 


@Dennis Knutson wrote:

All of the previous suggestions with state machines/case statements/waits, do not apply to generating two signals with a DAQ card. What you need to do is make sure that both simulated waveform generator functions are using the same sample rate and number of samples. Then pad the front of the Y array of the delayed waveform with 2 seconds worth of samples and delete the same number of samples from the end of the array.

 

Posting via smartphone so I can't post any code. If you get stuck, I can do that later, though I would not use the DAQ Assistant. What version of LabVIEW?


 

but.... but.... 😮   there was no mention of DAQ cards....  😮

 

 

 

😉

0 Kudos
Message 9 of 16
(6,891 Views)

 


@Ray.R wrote:

 


@Dennis Knutson wrote:

All of the previous suggestions with state machines/case statements/waits, do not apply to generating two signals with a DAQ card. What you need to do is make sure that both simulated waveform generator functions are using the same sample rate and number of samples. Then pad the front of the Y array of the delayed waveform with 2 seconds worth of samples and delete the same number of samples from the end of the array.

 

Posting via smartphone so I can't post any code. If you get stuck, I can do that later, though I would not use the DAQ Assistant. What version of LabVIEW?


 

but.... but.... 😮   there was no mention of DAQ cards....  😮

 

 

 

😉


I know. Imagine what kind of specifications will get written by some of these engineers?

 

Message 10 of 16
(6,888 Views)