LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time controlled Loop faster than 1ms

SteffenGrab,

Based on your original question about getting a timed loop faster that 1ms on a non-real-time machine (ex.  Windows), you can not get a faster loop time, unless you move to a real-time target.  Windows does not allow its users to access the frequency clock of the processor itself, thus only allowing the user to run no faster than 1ms timed loops.  Adding in hardware to a non-real-time system does not help the timed loop because the program is still running on a Windows based system.   If you bring in a real-time target system, then you will be able to get faster loop times. 

 

Michael B

0 Kudos
Message 11 of 24
(3,886 Views)

Let me clarify since my previous post could be understood as running under RT.

I have run

  • multiple timed loops
  • that used an NI PCI card as it clock source
  • at 2KHz
  • on a Windows desktop machine for an extended period of time
  • without any of the iterations "finishing Late".

I was both suprised and pleased

I can not post the code.

I accomplished this by exploiting everything I know about LV performance and the Windows OS.

And NO I did not have to change the priority of any of my VI's.

Ben

Discalimer: Running at 1KHz under Windows without the timed loop is still "hit and miss".

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 12 of 24
(3,880 Views)
Steffen,

i want to clear some things which might come up a little hard reading some of the answers...
Yes, of course you CAN get faster than 1ms even on Windows machines, but the only way to accomplish that is to use untimed structures like the "normal" loops. But you will have three major drawbacks which are not good for any control loop:
1) You will use 100% CPU load (50% on dual core systems) with the loop. Other threads (like user interface update) will get short in time and maybe even suffer faminishing....
2) The timing is absolutly not deterministic. When designing a controller, you define its reaction time as a hard timing requirement to the controller. This is not possible with an operating system like Windows which is not capable of realtime (which means: deterministic system).
3) A Controller requires single values to be acquired. This will be done in softwaretiming leading to an interrupt "going from your application to the DAQ device and back". With such a softwaretime, you are very dependend on the system setup and running applications on the system.... you can say that an acquisition rate of about 1-15 kHz is achiveable, but not deterministic......

Because of Windows being no RT-OS, you do not have a timing source available in LV which supports you with timings < 1ms. Even this value is not too precise since Windows is a preemptive OS so you can easily have latencies of >50ms.....

Using a special hardware CAN help a bit since you can do many (hopefully!) things with the hardware. But a simple AI-device will not help you much since:
- controllers need single values and then calculate an answer as output. The next sample reflects the answer from the system to the last output.....
- You cannot implement any logic on this device regarding a controller.
The only hardware usable as controller in Windows-systems are FPGA devices. And this only, if the whole controller algorithm fits on the FPGA..........


hope this helps,
Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 13 of 24
(3,879 Views)
Ben,

using external clocks with timed loops is like cheating 🙂

Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 14 of 24
(3,875 Views)
Norbert wrote
 

Ben,

using external clocks with timed loops is like cheating

 
When it comes to making computers do what my customers desire, I will not hesitate to "cheat". Smiley Wink
 
Have you compared the price of an NI PCI board with a PXI chassis lately? Smiley Very Happy
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 15 of 24
(3,873 Views)


Ben wrote:

Let me clarify since my previous post could be understood as running under RT.

I have run

  • multiple timed loops
  • that used an NI PCI card as it clock source
  • at 2KHz
  • on a Windows desktop machine for an extended period of time
  • without any of the iterations "finishing Late".

I was both suprised and pleased

I can not post the code.


I have also used this technique
Message 16 of 24
(3,863 Views)


Ben wrote:

Let me clarify since my previous post could be understood as running under RT.

I have run

  • multiple timed loops
  • that used an NI PCI card as it clock source
  • at 2KHz
  • on a Windows desktop machine for an extended period of time
  • without any of the iterations "finishing Late".

I was both suprised and pleased

I can not post the code.


I have also used this technique to
Message 17 of 24
(3,863 Views)


Norbert B wrote:
Ben,

using external clocks with timed loops is like cheating 🙂

Norbert


Ben,  Using external clocks came to mind...  (I can't say more here 😉 )
 
Norbert, cheating is what seperates the men from the boys.  😄 LOL!!  (I asking for a 1 star aren't I??  LOL!!)  😄
Message 18 of 24
(3,809 Views)

Ben wrote:
 
When it comes to making computers do what my customers desire, I will not hesitate to "cheat". Smiley Wink
 
Have you compared the price of an NI PCI board with a PXI chassis lately? Smiley Very Happy
 
Ben


Kind of doing that with a PCI-6123 (DAQ) & PCI-6602 (counter) tied together on the RTSI bus.
 
Wish I had LV-RT to play with 😉
 
My desire is for my computer to print out 24K gold nuggets.  Can I be your customer?  😄
Message 19 of 24
(3,801 Views)

Me too.  I've only tinkered, but have had successful (albeit brief) runs at 5 kHz with no late iterations using an M-series board as a timing source.  I was actually starting to piece together a DAQ-hardware-oriented Nugget, but that was a while back when I seemed to have some spare time...

Bad news for the original poster, Steffen:  I don't think a USB-based board will work nearly as well for this stuff (perhaps hardly at all) as a PCI card.

-Kevin P.



Message Edited by Kevin Price on 12-13-2007 03:49 PM
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 20 of 24
(3,776 Views)