11-06-2013 03:03 PM - edited 11-06-2013 03:05 PM
Hello RTSLVU,
This depends on how the subVI is dispatched- if it's non-reentrant or shared-clones and the sub-loops you've described exist within the same application context, then yes, the history will (read-can and probably will at some point) be mangled. You can address this by setting the subVI to use preallocated clones in File>>VI Properties>>Execution.
Redesigning this component sounds like a good idea at this point, though.
To clarify and better address your initial question: Local variables will only ever be shared within the same copy of a subVI. The question here is how many copies exist and whether or not they are being shared between different parts of your calling application. The default operation of new VIs is to be non-reentrant (only one copy exists) and in this case any history in the subVI will be shared/commingled.
Regards,
11-06-2013 03:06 PM
Here is a couple screen grabs of the block diagram showing V_WFM being used by the three loops simultaneously.
Hopefully this will make my original question clearer?
11-06-2013 03:35 PM - edited 11-06-2013 03:35 PM
@RTSLVU wrote:
Here is a couple screen grabs of the block diagram showing V_WFM being used by the three loops simultaneously.
Yes, if the three instances of the subVI should all keep their own dataspace, you need to simply make the sub-VI reentrant.
11-06-2013 04:48 PM
@RTSLVU wrote:
Here is a couple screen grabs of the block diagram showing V_WFM being used by the three loops simultaneously.
Hopefully this will make my original question clearer?
OUCH!
You can be glad the contractor is long gone. (I might know the name though....are the initials S.B.? no relation!)
11-08-2013 11:09 AM
I finally got some time on the equipment.
I am happy to announce I was right.
Using the same sub-vi with the same local variable "local array" in three loops simultaneously was causing the data in "local array" and therefore the displayed data to be a conglomeration of all three loops data, making all three graphs identical after a few iterations.
Now I have a ton of cleanup to do including a good 100 local variable instances X3 to get rid of.
As I said before I am not being paid enough.
11-08-2013 12:04 PM
I didn't look at the code, but it's likely that if you make that subVI re-entrant and set it to pre-allocate clones, the problem will go away. You may still want to re-write but perhaps that will get it up and running sooner. A reentrant subVI keeps a separate copy of all its controls and indicators for each instance, so the local variables will all be independent.
11-11-2013 04:27 PM - edited 11-11-2013 04:27 PM
WOW, just when I thought I had see everything I ran across this little gem in a sub-vi.
11-11-2013 05:15 PM
@RTSLVU wrote:
WOW, just when I thought I had see everything I ran across this little gem in a sub-vi.
No, it should use "build path" instead. This current code will instantly break on any other OS.
You should use concatenate on the file name only.
11-12-2013 01:36 AM
There's also the Array of strings to path, which seems like a good idea in this case.
/Y
11-12-2013 05:53 AM
@RTSLVU wrote:
[...]
My company is not paying me enough.
Apparently, they are. 🙂