LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data do not pass through case structure

  • How often is your case TRUE?
  • Now many files are output from the "list files"?
  • Some of your array indicators have the index at 24 instead of zero, so if the output array is smaller, you will not see anything.
  • There is a negate function. No need to multiply with a mismatched -1.
  • Mind your representation
  • Why is your blue shift register initialized with an array containing one element instead of an empty array?
  • Why do you attach new files with the same name as earlier attachments. Can lead to confusion and crosslinking. Please don't.
  • I stripped out your hardware and missing subVIs and things look just fine.
  • If you would use conditional indexing output tunnels, you would not need the case structure or shift registers. (not shown)
0 Kudos
Message 11 of 27
(941 Views)

I remove the clustering showed in the figure. It works now. But I still do not understand why cluster the wires before entering into case structure caused problems. I guess it is the problem of data passing between individual wires and cluster. Are the "bundle VI" and "Array index VI" by reference or by value?   

0 Kudos
Message 12 of 27
(920 Views)

I might have found the problem. In my parent VI, I used this VI twice in parallel. I heard that LabView is a pseudo OO Language. So perhaps the two simultaneously running VIs interfere with each other and cause the the problem? Any thought? 

0 Kudos
Message 13 of 27
(894 Views)

@Jacobier wrote:

I might have found the problem. In my parent VI, I used this VI twice in parallel. I heard that LabView is a pseudo OO Language. So perhaps the two simultaneously running VIs interfere with each other and cause the the problem? Any thought? 


By default, VIs are non-reentrant, meaning all instances in your code share a copy and it cannot be used simultaneously in two different places at the very same time. You can easily make them reentrant (vi properties..execution...).

 

Your VIs don't store local data (e.g. uninitialized shift registers) and I cannot see how non-reentrant uses would be a problem unless you try to run two instances in parallel. Do you?

 

Can you give us a little insight into the overall code architecture?

0 Kudos
Message 14 of 27
(872 Views)

Yes, I did run two copies of this VI parallel in the upper level VI. This VI is my image processing code. I have data from two cameras that need to be processed.  If I need to run two instances of the same VI parallelly (Like two objects of the same class in other OOP languages). Which setting in execution I should use?

0 Kudos
Message 15 of 27
(861 Views)

Do I need to make all the subVIs under this VI reentriable as well?

0 Kudos
Message 16 of 27
(858 Views)

If they are not reentrant, one instance must wait until the other instance has completed. If you make them reentrant, they can run in parallel. Look at the help on the execution settings.

I assume that each instance operates on a different folder, right? What is the bottleneck? If the bottleneck is disk IO, that cannot be parallel, if course.

I don't have IMAQ installed at the moment, but please don't modify system VIs.

One of your subVIs is "vector remove...". What does it do? (can you attach the code?). If it completes in an instance, it does not really need to be reentrant, but you are calling it several times in parallel and reentrant might help. You might even inline it. How many CPU cores do you have?

 

Your code is still somewhat of a mess. Do you understand my earlier comments?

0 Kudos
Message 17 of 27
(854 Views)

Thank you for your quick answer. 

 

1. I do not need to make them parallel. But by default, in LabViews if I put two subVIs in the same block with two different paths, they automatically become parallel. In this case, does it mean that the same subVI needs to be on the same path (or connected in series)?

2. Yes, each instance operates on a different folder. 

3. I tried to run my code step by step using debug tools, I found that the two parallel subVI (the one I posted) only run once. It did not look like on instance is waiting for another. I am guessing that this is the root cause of the problem.

4 "Vector remove" is just to remove the first element or the last element of an array. What confused me more is that these subVIs did not cause any problem even they are paralleled.  

 

0 Kudos
Message 18 of 27
(842 Views)

@Jacobier wrote:

But by default, in LabViews if I put two subVIs in the same block with two different paths, they automatically become parallel. 

 


No, they don't become parallel. They get both scheduled to run, but whatever instance is first will prevent the other instance from running until it is done. Once it is reentrant, both have their own code and can run at the same time.

 

Can you tell me in more detail what you are seeing when stepping through the code? Too ambiguous. Can you probe e.g. the path inside the subVI?

 


@Jacobier wrote:

 

4 "Vector remove" is just to remove the first element or the last element of an array. What confused me more is that these subVIs did not cause any problem even they are paralleled.  


Why would you need a subVI for that? Just take the array subset starting at 1 with a length of N-2.

0 Kudos
Message 19 of 27
(839 Views)

As mentioned, you can make your code 7x smaller by using a single 2D array in a shift register. Why is your cluster size set to 9 for "Array to cluster"? Why does your blue array constant contain an element?

0 Kudos
Message 20 of 27
(832 Views)