LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execution time for Call Library Function Node

Solved!
Go to solution

I am experimenting with the Call Library Function Node block in LabVIEW and am curious if it should be running faster than what I'm seeing.  For testing purposes, I have compiled and transfered to my RT target the .out file from the KB article http://digital.ni.com/public.nsf/allkb/81D1172E3C28A5E4862575CC0076A230 (I'm using the vxworks 6.1 version).  The function in the .out file just multiplies two inputs together, adds a constant, and returns the result.  I have put this inside a 1 kHz timed loop with a commanded period of 1 ms and via the Ticks(ms) block and shift registers I calculate the amount of time per loop execution.  This process is apparently taking 5 ms per cycle and to me that seems slow.  Is that roughly the correct execution time for this kind of setup?  I will attach my test .vi file.

 

What I'm using:

Windows 7

LabVIEW 2009 SP1

NI-cRIO 9024 with NI-RIO 3.4.0

 

 

0 Kudos
Message 1 of 7
(3,970 Views)

First off, the way you are doing timing isn't necessarily accurate because you don't know when the tick count VI is being called. For example, if it gets called on one iteration after your call library node executes, and the next iteration it gets called before the CLFN it executes, the subtraction doesn't include the call of the CLFN so you aren't seeing the true time it is taking for the dll to be called.

 

Where it says "error" on the top left hand corner of your loop. left click and choose previous iteration timing. Also, do you have the ability to choose a 1 Mhz clock? Are you sure it's actually being run on the RT and not on your PC? Running it on the PC would definitely make it difficult to execute at a 1 kHz rate.

0 Kudos
Message 2 of 7
(3,958 Views)
Solution
Accepted by topic author jbailey86

 

Another thing you need to change is to double-click on the Call Library Node and change the thread it runs in from the UI thread to any thread. The UI thread won't help you when you're trying to run as fast as possible.

Message 3 of 7
(3,953 Views)

How do you use VxWorks 6.1 with LabVIEW 2009? LabVIEW 2009 compatible realtime targets all run the a kernel based on VxWorks 6.3.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 7
(3,943 Views)

I changed the way I was measuring the execution per for(imstuck)'s recommendation and more accurately measured the loop to be running at ~250 Hz.  And yes it was definitely being run on a RT target.

0 Kudos
Message 5 of 7
(3,934 Views)

I went through the procedure outlined in that article with the 6.3 version and could not compile succesfully.  I tried the 6.1 version and it worked.  It looks like my cRIO has files for both 6.1 and 6.3 on it.  Not sure why the newer version didn't work for me.

0 Kudos
Message 6 of 7
(3,932 Views)

Configuring the Call Library Function Node to "Run in any thread fixed" fixed the problem and I can now execute the loop in the preferred amount of time.  Thanks for all of your help.

0 Kudos
Message 7 of 7
(3,930 Views)