LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For Loop with Parallelism and Class Wire

Solved!
Go to solution

Tesla1977_0-1759751483120.png

 

Does this parallel For Loop create copies of the Class or does it pass by reference? 

 

Or asked in a different way:

Does this make any sense or do I destroy my parallelism?

Tesla1977_0-1759751726519.png

 

 

0 Kudos
Message 1 of 4
(370 Views)
Solution
Accepted by topic author Tesla1977

Hi,

 

Image 1:

Yes, each iteration will have its own independent copy of the object.

Be careful, if the loop executes 0 time (in case your input arrays are empty), the class output tunnel will give the default value for the class (you will loose your object's private data).

 

Image 2:

Using a shift register will reuse the same object in place (so no copy), but it will force a sequential execution of the iterations.

 

We could give better advice if you explained in more details what you are trying to achieve, why the parallelism and what each input/output represents.

 

Regards,

Raphaël.

Message 2 of 4
(332 Views)

Thank you for your answer.

 

After the loop I will still have the private data available that I input before the loop, I guess.

And I am definitely not changing any private data inside the loop.

But thanks for your input that the data is lost when the loop executes 0 times.

 

I want to read chunks of data from different ECUs via diagnostics, that takes 100-200ms. I do not want that to happen sequentially, but in parallel (each execution is one ECU). Therefore the parallel For Loop.

 

Input is the session data, output is the read data.

 

My only concern then is that if I run the whole thing in a while loop I will be creating lots and lots of object copies...

0 Kudos
Message 3 of 4
(319 Views)

LVOOP always have classes by value, if you want referenced based classes you'll need G# or GOOP.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 4
(302 Views)