Author Topic: Any way to reduce delay in LabView?  (Read 761 times)

0 Members and 1 Guest are viewing this topic.

Offline LoveLaikaTopic starter

  • Frequent Contributor
  • **
  • Posts: 610
  • Country: us
Any way to reduce delay in LabView?
« on: January 14, 2025, 07:42:35 pm »
Anyone ever worked with LabView before? I'm encountering a problem with it, and I'm at a loss on how to approach.

As a proof of concept, I'm using the software to output a sine wave from a waveform generator. I want to only output the sine wave for (in this case) 2 cycles. As you can see in the image of my program, I initialize the generator, configure the waveform, enable the output, wait for the amount of time calculated for 2 cycles, and disable the output.

The problem I'm facing is that it doesn't ideally start at V=0, the start of a cycle. Rather, the time to wait starts a little after the output has been enabled. So, rather than starting at the ideal time, the output sine wave has risen to a higher voltage than V=0 ideally when the waiting begins. Why is this occurring, and what can I do? I feel that it's a software delay of sorts, but I don't know how to make it more accurate.
 

Offline joeqsmith

  • Super Contributor
  • ***
  • Posts: 12399
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #1 on: January 14, 2025, 08:34:44 pm »
This seems to be more of a question on how your Arb works.  You should be able to program it to send two sweeps when sending a trigger event.   Don't try and time this is software.   

Offline joeqsmith

  • Super Contributor
  • ***
  • Posts: 12399
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #2 on: January 14, 2025, 08:55:01 pm »
Looks like GWI decided to ripoff the Tektronix model number.   Which arb do you have?   Provide a link to the programming manual.   

https://www.tek.com/en/products/signal-generators/arbitrary-function-generator/afg2000
https://www.gwinstek.com/en-US/products/detail/AFG-2100_AFG-2000


Offline Sensorcat

  • Regular Contributor
  • *
  • Posts: 133
  • Country: de
  • Independent Sensor Consultant
    • Sensorberatung
Re: Any way to reduce delay in LabView?
« Reply #3 on: January 15, 2025, 12:43:17 am »
This has little to do with LabView. The operating system of any modern PC prevents any application program (like a LabView VI) to get direct access to hardware like an interface that is used to connect an instrument. The commands are transferred to the instrument when the operating system allows it. Without a real-time system, there's no way to force the system to use a precise schedule for that. The operating system arbitrarily assigns CPU time with little the application programmer can do about it (apart from tweaking priorities a bit).

Similar issues on the receiver side: There is no guarantee that a received command is executed in a fixed time.

So what to do then? Key is to let hardware do all time-critical stuff, not software. In your particular case, that means setting up the AWG to do the task completely, then, start it and let LabView stop it much later. However, it seems that the GW Instek AFG2000 lacks the function to do this: burst mode. This mode, available on most modern AWG, would let you set a 2 cycles burst as the output signal. If you do not have this, you can try to get creative with trigger / sync or ARB mode. But in the end, a more capable AWG is the better solution.
 

Offline inse

  • Super Contributor
  • ***
  • Posts: 1072
  • Country: de
Re: Any way to reduce delay in LabView?
« Reply #4 on: January 15, 2025, 05:27:11 am »
Cumbersome workaround if no suitable function generator is available: define the desired signal burst with a pause at the end as arbitrary waveform.
Use e.g. Excel to calculate and compile the waveform data to be sent to the AWG.
« Last Edit: January 15, 2025, 07:36:01 pm by inse »
 

Offline joeqsmith

  • Super Contributor
  • ***
  • Posts: 12399
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #5 on: January 15, 2025, 04:35:54 pm »
Sadly OP never responded but it does appear they have a GWI and not a Tektronix arb.    Downloading their software and manual, it appears you can set the trigger to manual, then send a trigger command.   Sadly I it appears undocumented in the manual but they do talk about using the external trigger for a one-shot.  The Arb will sweep once and wait for the next trigger.  It would make sense that the manual trigger would work this way but I don't have the arb to try it. 

Use these two commands manual trigger and send the trigger command and let us know if you get a single sweep or multiple.

Offline LoveLaikaTopic starter

  • Frequent Contributor
  • **
  • Posts: 610
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #6 on: January 15, 2025, 07:20:51 pm »
Apologies for the delay in replying. It's a Gwinstek 2112. At least communication with it is straightforward, but you think they would update the VIs. Sad to see it incorrect.
 

Offline LoveLaikaTopic starter

  • Frequent Contributor
  • **
  • Posts: 610
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #7 on: January 15, 2025, 07:24:40 pm »
Sorry for not replying sooner. Life happened. It's a Gwinstek 2112. The thing about triggering is that you need a source, and we don't have an external source that can do the triggering. No DAQ or signal generator that we can set to send a trigger pulse.
 

Offline LoveLaikaTopic starter

  • Frequent Contributor
  • **
  • Posts: 610
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #8 on: January 15, 2025, 07:28:05 pm »
Thanks for replying. I'm beginning to think that this might be the way, but thing is, when we output it as an arbitrary waveform, there's no set start/stop time. It just runs continuously.
 

Offline joeqsmith

  • Super Contributor
  • ***
  • Posts: 12399
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #9 on: January 15, 2025, 09:43:02 pm »
Thanks for replying. I'm beginning to think that this might be the way, but thing is, when we output it as an arbitrary waveform, there's no set start/stop time. It just runs continuously.

So trigger doesn't work when a arbitrary waveform is selected.  Hard to believe but I don't own one to try it.  Time for a better tool. 

Offline LoveLaikaTopic starter

  • Frequent Contributor
  • **
  • Posts: 610
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #10 on: January 16, 2025, 04:01:45 am »
After going through the available functions, we came to the conclusion that the function generator and the available options to operate it along with the delays and such are unsuitable for our needs. It wasn't just the delays; we wanted to output a portion of a signal, and we don't have any available functions to specify when to output a signal and for how long.


Playing around in LabVIEW, we found that we can get what we want in software, just need a way to output it is all
 

Offline LoveLaikaTopic starter

  • Frequent Contributor
  • **
  • Posts: 610
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #11 on: January 16, 2025, 04:02:18 am »
After going through the available functions, we came to the conclusion that the function generator and the available options to operate it along with the delays and such are unsuitable for our needs. It wasn't just the delays; we wanted to output a portion of a signal, and we don't have any available functions to specify when to output a signal and for how long.


Playing around in LabVIEW, we found that we can get what we want in software, just need a way to output it is all
 

Offline joeqsmith

  • Super Contributor
  • ***
  • Posts: 12399
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #12 on: January 16, 2025, 07:00:45 pm »
I would imagine you would load the arb with the partial wave you want to output?   Of course you would need to write software to do this but should be trivial.  Not being able to control the trigger as you suggest is the problem.   Looks like the Arb isn't super cheap.  I'm really surprised that when you use the programmable waveform, you can't control the trigger. 

Offline LoveLaikaTopic starter

  • Frequent Contributor
  • **
  • Posts: 610
  • Country: us
Re: Any way to reduce delay in LabView?
« Reply #13 on: January 17, 2025, 04:18:42 pm »
When outputting a continuous waveform directly from LabVIEW, the function generator's output (going to an oscilloscope) showed a delay between when we expect the sine wave to start (0 volts) and what is shown on the oscilloscope (not 0 volts). We could load an arbitrary waveform, but there's no guarantee that we will get the start/stop points that we want with the generator. It was easier to do it in LabVIEW. That way, we can send out exactly what we want, when we want, and for how long.
 

Offline inse

  • Super Contributor
  • ***
  • Posts: 1072
  • Country: de
Re: Any way to reduce delay in LabView?
« Reply #14 on: January 17, 2025, 04:27:43 pm »
What is the hardware that generates the signal, then?
How do you achieve the realtime behaviour and what does the signal need to be synchronized with?
« Last Edit: January 17, 2025, 04:31:19 pm by inse »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf