09-13-2016 07:44 AM
Sometimes when you have a new concept (like "How does a Sub-Panel Work?"), it helps to build "The World's Simplest Demo Program" to try the basic concept, then "make it more complicated". Here's a Sub-Panel example.
My "Main", which includes the Sub-Panel and a call to a single sub-VI that will run in the Panel, is extremely simple.
This does the following:
It doesn't really matter what the sub-VI does. I made a simple Uniform Random Number generator running at 50 Hz, with a running average of the last 5 numbers showing a "low-pass filter" effect, and a Stop Button to demonstrate User Interaction with this VI running in the sub-Panel. Note that this sub-VI must be closed in order to be called to run in a sub-Panel (otherwise you get Error 1144).
If you have LabVIEW 2016, these are both LabVIEW Snippets that you can drag to a blank LabVIEW Block Diagram and save. This second VI I had saved as the sub-VI "Do Some Work", and is the VI whose static VI Reference is used in the main Sub-Panel demo shown first. If you are creating them "from scratch", you should be able to simply lay down the Structures and Functions as I have done.
Bob Schor
09-14-2016 05:14 AM
Thank you.
Then the structure to follow is:
Subpanel -Sampling in the subVI.
-Ejecuto The subVI.
-Finalizo The subVI.
I close the subpanel.
Would this be a correct structure?
Tanks
09-14-2016 07:06 AM
I'm trying to run the subVI into the subpanel using Boolean controls, so good.
But when I perform the operation I turn, I turn back to light when an error jumps 1198 and have to close the whole project to reopen it for functions.
They know that this is ...
this is my test VI.
09-14-2016 07:37 AM
LabVIEW: (Hex 0x4AE) Error 1198 The VI is not in a state compatible with this operation. Change the execution mode of the referenced VI to reentrant for this operation.
-The above error says you cannot run the VI in reentrant mode.
- What is reentrant mode: By default, when LabVIEW calls the same subVI from multiple locations within either the same VI or different VIs, only one instance of that subVI can run at a time. This limitation occurs because the subVI reserves only a single space in memory to store its data, so all instances of the subVI must take turns using that data space. However, if you configure the subVI for reentrant execution, LabVIEW can execute all instances of the subVI simultaneously.
- LabVIEW provides the following types of reentrant VIs:
-Use the Start Asynchronous Call node instead of the Run VI method to run target VIs asynchronously.
-How to call VI asynchronously for parallel execution: https://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/acbr_call_clones/
-Source: https://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/reentrancy/
09-14-2016 07:53 AM
Curious. When I downloaded VI1198, it was set to "Non-reentrant execution". When I combined it with the code in the earlier Project (it would have been nice to have all of the files again sent as a Zip to ensure we were all talking about the same VIs), it ran without error.
There are, however, several things "wrong".
The code I attached ran the sub-VI "in-line", so a necessary condition for removing the sub-VI from the sub-Panel was that the sub-VI had to exit. In your case, you are running your sub-VI asynchronously, without waiting for it to exit.
Is this what you intend? Did you want to start a parallel loop running "out-of-sight" of your main VI and periodically "take a look at" its Front Panel? That's what your code is doing. If that is what you want, that's what you have.
Bob Schor
09-14-2016 11:27 AM - edited 09-14-2016 11:32 AM
@udka wrote:LabVIEW: (Hex 0x4AE) Error 1198 The VI is not in a state compatible with this operation. Change the execution mode of the referenced VI to reentrant for this operation.
-The above error says you cannot run the VI in reentrant mode.
No, It says that the VI needs to be re-entrant to be inserted multiple times and it currently is not. As pointed out days ago, he is trying to insert a VI that is already inserted, over and over again. You can only launch new parallel instances if the VI is reentrant.
Reentrancy is not the problem. The problem is that the code does not keep track if the VI is already inserted or not. It keeps pounding the head into the same wall over and over.
Making the VI reentrant would make things worse. After a while you would have millions of parallel instances of the same VI running and you will run out of memory.
09-14-2016 11:32 AM
09-15-2016 03:29 AM
Hello, I think this is me this out of hand.
I just do not understand the approaches and offer.
On the one hand I understand that using a Boolean to power and another to cancel is not the most effective but the goal of this operation was to understand the operation of the VI.
On the other lado.¿ As verify that the VI is open or closed?
If I start the subVI and place it in the subpanel, this must remain active until an action close the subVI clearing the subpanel for the execution of another or the same VI.
That's the approach I want.
But seeing different structures in forums like block and some more number of blocks used. And this confuses me because the idea 100% of each block do not know and I'm starting to confuse.
I appreciate all the advice.
But if they know something text where this explained the correct use of a block would do me a favor.
In addition seguerencía or any help it is welcome
09-15-2016 04:22 AM
Sorry for the confusion if i had made. Let's get things clear.
-Start new VI and Complete the following steps to load a front panel in a subpanel control.
-Now notice that you can load a subvi named Untitled5.vi opens in subpanel and waits until you press stop button.
-Now Open VI reference creates the reference to the vi which you want to run.
-VI run Invoke method will make the VI to start executing.
-Subpanel Insert method will insert the subvi front panel into Subpanel.
-The while loop is to ensure the vi is escuting and keep the refernce alive.
-When you press stop the reference is closed and the vi will be remove from the memory.
-You can check if a vi is running or not by creating property node and selecting the execution state
P.S. whenever In confusion start with fresh VI rather than mixing up with already existing VI and complicating it. I hope above post helps if not completely ignore and proceed as suggested by others.
09-22-2016 03:13 AM
Hi, I'm back :). I've been trying to work and actually I work, the problem is that when re-run the subVI this works but does not open (not displayed on the SubVI but if ejectuta).
I tried to change the call or putting it as reentrant but still can not get display ...
Any ideas?
thank you very much