01-10-2017 12:30 PM
To be clear I don't need these two processes to run in parallel, I think they should, but I don't need that. The real program will have pulses sent out continuously which once set up requires no input from labview. Really I just need to understand the behavior of the read process so I can account for it when I code.
01-13-2017 01:17 PM
UPDATE:
I think I understand what some were trying to tell me here. When I see this code:
My fist thought is these two read commands are independant. They both wait for the same error line, and will start at the same time but should run in parallel. It turns out though that labview runs these in series. I had to separate them into two different while loops in order for them to run in parallel.
Even though they both wait on the same event to happen (my button press) labview runs them in parallel.
Now my question is this: How do I know when Labview will run a set of commands together or in parallel? Is there any kind of post-compile tool that can report this? I will post this as a new question as well since it is beyond my originall question that started this discussion.
Thank you all for the feedback!
01-13-2017 01:58 PM
@fsTAS wrote:
I think I understand what some were trying to tell me here. When I see this code:
My fist thought is these two read commands are independant. They both wait for the same error line, and will start at the same time but should run in parallel. It turns out though that labview runs these in series. I had to separate them into two different while loops in order for them to run in parallel.
I still think they cannot run completely in parallel due to the .NET interface. If those were reentrant VIs, I would expect them to run in parallel.
01-13-2017 07:32 PM
I'm lacking enough information to know for sure, but one potential problem is that I don't think the two .NET references you are acting on are actually seperate references based the image you attached. If you look to the initialize flame subVI you get an array of .NET references but then feed the first index into both sets of initialization methods (it doesn't look like you intended to do this). You build the array and index them properly when you feed them into the get spectrum methods they are both acting on the same object which may explain why they are not able to run in parallel. In the example you show us that works you are acting on two separate references so that could be it.
I'm guessing based on context clues but the methods may be forced to run in serial because they are sharing a single hardware resource.
01-14-2017 02:19 PM - edited 01-14-2017 02:24 PM
@fsTAS wrote:
UPDATE:
I think I understand what some were trying to tell me here. When I see this code:
My fist thought is these two read commands are independant. They both wait for the same error line, and will start at the same time but should run in parallel. It turns out though that labview runs these in series. I had to separate them into two different while loops in order for them to run in parallel.
Even though they both wait on the same event to happen (my button press) labview runs them in parallel.
If you look just a bit farther back in your code you will note that the .NET referance is 1 branched wire (Test this by seeing it the referances are equal, I would bet that they are) So, even if the .NET code is multi-threaded, you are involking the same instance of the object.
In your two-loop example you instantiate the .net object in each loop. What do you think would happen if you dropped the .net ref outside the for loops and branched it into the loops? Try it! what happened? Tricky
01-14-2017 06:46 PM
Thank you for the replys, unfortunatelly there is only one .net refference. I'm including the Init file that generates the .net refference for clarity. Ocean Optics only want one instance of its 'wrapper' object created even when using multiple spectrometers. The array is built because the guy who wrote it before me thought he needed to, but in fact it's the same .net refference.
I've included the two peices of code that illustrate the issue I was having the best, along with screenshots of the oscilloscopes. I don't have a four channel oscilloscope and had to use two two channels instead. In these pitures I read two spectrums from both spectrometers and send ten hardware triggers to the spectrometers. In the twoWhile set they both read at the same time. The third feedback is due to the spectrometer reading one more spectrum because its output buffer is empty. In the oneWhile set you can see that each read happens on different hardware triggers. Again extra feedback pulses are seen due to the spectrometers reading an extra spectrum because their output buffers are empty.
01-16-2017 01:12 PM
In the twoWhile set they both read at the same time. The third feedback is due to the spectrometer reading one more spectrum because its output buffer is empty. In the oneWhile set you can see that each read happens on different hardware triggers.
I goofed, the names are switched. The picture labeled "oneWhile" is the output when running the VI with 2 while loops. The "twoWhile" picture is when running the VI with 1 while loop. I apologize for any confusion this may cause.