LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute two nodes exactly at the same time

I have to call two functions from dll using call library function node. The functions must be executed at the same time. How can I realize this in Labview?

 

Untitled.png

0 Kudos
Message 1 of 11
(4,106 Views)

According to the Principles of Data Flow, putting them together in a Flat Sequence Structure and having them have the same inputs is largely the "best you can do", ensuring that they start at the "same" (to within a few clock ticks) time.  What happens within the two DLLs (i.e. does one "hog" all the CPU cycles, or call a "shared" resource that forces the other to "wait until I'm done with it"?) may be beyond your control, but you at least started them together.

 

Bob Schor

Message 2 of 11
(4,097 Views)

Hi Skoda,

 

call two functions from dll using call library function node. The functions must be executed at the same time.

This will only work when the DLL allows to call those functions in parallel. Does it?

And it will only work in parallel when the underlying communication scheme allows parallel communication with your device. Does it?

Does your computer offer more than one CPU core to be able to handle both calls in parallel?

 

"Exactly at the same time" is a very strict requirement! Are you talking about 1ps resolution or just 5ms?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 11
(4,096 Views)

Here are some suggestions in addition to the attached snippet:

-set identical absolute time for timed structure to start (future time event)

-assigned different processors to each task

-identical timed structure priority setting

-set "call library function" to "run in any thread"

-may get benefit from setting subVI 1 and 2 execution priority to high or time critical

 

parallel_processes_timed.png

0 Kudos
Message 4 of 11
(4,088 Views)

Did you make that subVI re-entrant?

0 Kudos
Message 5 of 11
(4,080 Views)

And add to the list offered by others...

 

Is the node where you are calling the dll yellow or orange?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 11
(4,065 Views)

@Skoda3 wrote:

The functions must be executed at the same time. How can I realize this in Labview?


Nothing can be guaranteed to happen at exactly the same time, all you can do is specify max allowable jitter. (You get close on an FPGA or if you can tie things together with a hardware trigger, but you still have differences if the wires have different length, etc. :D). How do you tell if they don't execute at exactly the same time? Is that something you can measure reliably? What do the functions do? Do they communicate with an external instrument? Since the upper wire is shared, do they interact with a shared resource? (e.g. DAQ hardware).

 

Is this running on a PC or on an RT system?

 

 

0 Kudos
Message 7 of 11
(4,031 Views)

If I set VIs as Preallocated Clone executio it just does not work any more. I cannot get data from each of the VIs.

0 Kudos
Message 8 of 11
(3,972 Views)

@Skoda3 wrote:
It is orange. Why?

EDIT: If I set VIs as Preallocated Clone executio it just does not work any more. I cannot get data from each of the VIs.


Orange means 'running in UI thread', and has as a side effect that they are thread safe. That means the dll functions will wait for each other to finish.

Message 9 of 11
(3,966 Views)

Okej so If call library function nodes wait for each other (orange call library function node), this means that if I want to parallelyze execution I have to mark "Prealocated clone execution" to get parallelism?

0 Kudos
Message 10 of 11
(3,961 Views)