06-17-2017 05:20 PM
Hi All
I am experimenting with using event structures in sub-VIs with the eventual goal of consolidating a very large control system I am working on.
Attached is the toy-model I am working on. The VI works in the sense that the top level VI can control the the sub level VI, but then I want to pass the results back to the top level -- in this case it just a a Boolean LED indicator. I think I could achieve this using a refnum indicator and then converting this to boolean with a property node in the top level VI but this feels a bit clumsy.
VIs are attached!
06-17-2017 05:28 PM
Yes. You need to pass in refnums of your indicators on the main VI.
This isn't clumsy. What is clumsy is having a subVI that runs forever. Your main VI can technically never end without aborting your program because once it calls the subVI, the subVI has an infinite while loop.
06-17-2017 05:34 PM
Okay I see. What would you suggest to implement what I am trying to achieve in a better way?
06-17-2017 05:49 PM
I don't really know what you are trying to achieve.
Why do yo have a subVI with a while loop in it? Not that you can't do that, but when you do, you are going to treat it like a parallel process. That means not having indicators directly based on it by way of its connector panel. Also you need a communication mechanism to tell it when to shutdown.
06-17-2017 05:56 PM
Essentially code reduction. I am redeveloping a very large control system. This system currently has about 20 different event structures each containing relatively complex code. I want to bundle these individual routines up into subVIs to make everything more manageable, hence my experimenting with the attached example.
06-17-2017 07:02 PM
I guess this is a continuation of this earlier discussion. Why not keep it all in one place?