LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set of time parameter in the sin generation

Greetings everyone! I'm currently facing an issue regarding the precise timing of sinusoidal signal generation. In my program, I aim to generate a sinusoidal signal with an amplitude of 0.5 and an offset of 1. However, I'm encountering a delay between the output generation of the sinusoid and the input signal I'm reading, which is set at 500 Hz. In addition to my previous query, I would like to mention that my ultimate goal is to analyze the frequency response of a motor. To achieve this, I plan to utilize sinusoidal generation at various frequencies.

 

I have included a graph for reference, where the green line represents the signal I generate, and the red line represents the signal I am reading. It is evident that there is a noticeable delay between the two signals.

 

I'm having trouble understanding the relationship between the timing of the sinusoidal generation and the input signal reading. Could someone provide some guidance on this matter? Your assistance would be greatly appreciated.

Download All
0 Kudos
Message 1 of 12
(1,351 Views)

Sorry, I cannot look at your code (unless you save for previous and reattach), but your two signals have different frequencies, so how do you define "delay"?

0 Kudos
Message 2 of 12
(1,344 Views)

this is the file with labview code

0 Kudos
Message 3 of 12
(1,337 Views)

Well, all you have is a free-running toplevel loop using no obvious timing whatsoever (where you output a single scalar and read an array of two data points (all in no particular order!) with each iteration). Where is the queue used?

 

You need to use hardware timing.

 

(You really should get rid of the dynamic data and all the to/from dynamic data, etc. Way too opaque)

0 Kudos
Message 4 of 12
(1,317 Views)

I suggest that you write a "small" program first, one that acquires N-channels of sampled data at 500 Hz, but sampling 500 (or 1000) samples at a time.

 

If you want accurate and precise timing, you cannot use the PC's clock to take multiple samples -- it just is not precise enough to do this.  Fortunately, DAQmx hardware has more reliable clocks that only time the DAQ hardware, so if you take 500 points at 500 Hz, it will reliably take 1 second per sampling.

 

One second should give you enough time to send the data to a Graph.  So write a simple program to do this and plot the results.  Note you will get a 2D Array from the NChan NSamp DAQmx Read, which can (and should) be directly wired into your Load Cell and Input Motor graphs (please don't use the Dynamic Data Wire.  You should also be able to generate the appropriate 1D Array of a Sine Wave within the 1s you are waiting for the data.  Much better to process your data in "chunks" (using "hardware" timing) than one-at-a-time, using Windows timing and much messier "point-by-point" processing.

 

Bob Schor

0 Kudos
Message 5 of 12
(1,310 Views)

Thank you for your answer, but if I put the hardware timing in the DAQmx the labview give me an error: 

"Possible reason(s):

Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property.

Property: SampQuant.SampMode
Requested Value: Hardware Timed Single Point
Possible Values: Finite Samples, Continuous Samples

Task Name: _unnamedTask<1CA9E>"

0 Kudos
Message 6 of 12
(1,297 Views)