LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure and diagram disable structure anomaly!!!!!!!!

Solved!
Go to solution

Hai all,

 

I got really confused when i carried out an activity to test the exact behaviour between case structure and diagram disable structure.

 

I created 2 simple Vi's namely ref.vi and add.vi (placed  in different drive and directory).  I have attached the two vi's here.

 

Ref.vi simply opens a reference to add.vi with string constant wired to "Vi path" of "Open VI referance " which means that referance will be successfully opened in two cases:

1. add.vi should be in memory

2. add.vi should be in same path as ref.vi ( in this case it is in different path and can be ignored)

 

So only first option is applicable in this activity. 

 

Below are the sequence of activities carried out:

 

 1. Run the ref.vi without placing the add.vi in the blockdiagram - Returns error since the VI is not in memory which is expected behaviour.

 

 2. When the add.vi is placed in the block diagram inside "disabled" case of diagram disable structure and run the VI  i dont get an error!!!!!!!According to diagram diable structure help any code block inside diagram disable structure will not be loaded into memory. Which means that this step too should return error.  I have tried even reopening LabVIEW and not showing the blockdiagram of ref.vi (coz showing block diagram loads the vi into memory as per the link)

http://zone.ni.com/devzone/cda/tut/p/id/3684

 

 3. When the add.vi is placed inside TRUE case with FALSE constant wired still the referance is successfully opened.  This again contradicts http://forums.ni.com/ni/board/message?board.id=170&message.id=313265&requireLogin=False this post.  The code within TRUE case will not be loaded if it is wired with FALSE constant is what the discussion means.

 

 4.  Profile performance and memory shows both the vi's ??!!!! even if add.vi is in disable structure.  Is that a expected behaviour ???

 

These activities really confused because i carried out same activity some months back and i got correct result as per the tutorial and discussion.  But all these turned in opposited direction this time.

 

Am using LabVIEW 8.5 Professional developement system.

 

Kindly throw light on what is the actual funda and when does a VI will not be loaded in memory.

 

Any response would be appreciated. 

 

With regards,

JK 

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 1 of 9
(3,722 Views)
Couldn attach the vi's shows "unexpected error"...giving the images of the block diagrams....
With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
Download All
0 Kudos
Message 2 of 9
(3,718 Views)

Are you using Google Chrome or Safari?  They have some bug that prevents files with only 2 letter extensions such as .vi from being attached.   See here

 


 

3. When the add.vi is placed inside TRUE case with FALSE constant wired still the referance is successfully opened.  This again contradicts http://forums.ni.com/ni/board/message?board.id=170&message.id=313265&requireLogin=False this post.  The code within TRUE case will not be loaded if it is wired with FALSE constant is what the discussion means.


 

To answer your question.  In older versions of LV such as 7.1, the compiler would not load code if it was in a case structure that could not run such as code in a true case with a false constant wired to the selector.  That behavior changed in later versions of LabVIEW.  That is why now if you open older code, you might get a warning message saying that a diagram constant was changed to a hidden control.  That way whatever behavior you establish or program for in a newer version of LV will be the same if you ever do a save as back to one of the older versions.  Code in a diagram disable structure does not get loaded, which is more equivalent to the old behavior of the true constant/false case in the older versions of LV.

Message Edited by Ravens Fan on 01-07-2009 12:11 AM
0 Kudos
Message 3 of 9
(3,711 Views)


 

To answer your question.  In older versions of LV such as 7.1, the compiler would not load code if it was in a case structure that could not run such as code in a true case with a false constant wired to the selector.  That behavior changed in later versions of LabVIEW.  That is why now if you open older code, you might get a warning message saying that a diagram constant was changed to a hidden control.  That way whatever behavior you establish or program for in a newer version of LV will be the same if you ever do a save as back to one of the older versions.  Code in a diagram disable structure does not get loaded, which is more equivalent to the old behavior of the true constant/false case in the older versions of LV.

Message Edited by Ravens Fan on 01-07-2009 12:11 AM

For the sake of correctness,Ravens Fan just has it wrong in his head. In LabVIEW 8.x code in a structure that will never execute (True case in a 'False' connected case structure') is not loaded into memory.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 4 of 9
(3,695 Views)

Rereading your message and the link you gave, I think I may have gotten the "old vs. new" behaviors mixed up as well.

 

What is interesting about your message is that you say it worked as expected some months ago, but the behavior as changed.

 

Are you 100% sure you don't have the VI loading into memory?  Perhaps there is a stray copy of the subVI buried away somewhere in the VI, perhaps underneath a structure where you can't see it?

 

EDIT:  Thanks, TonP.   I see you picked up on the fact that I mixed up the behaviors while I was going back to double check and fix my message which had since timed out.Smiley Happy

Message Edited by Ravens Fan on 01-07-2009 12:24 AM
0 Kudos
Message 5 of 9
(3,693 Views)

Thanks a lot for your response

 

Was using chorme....Attaching vi's using iexplorer... Smiley Happy

 

Just give a try and give your feed back on the case structure execution scheme.

 

 


Are you 100% sure you don't have the VI loading into memory?  Perhaps there is a stray copy of the subVI buried away somewhere in the VI, perhaps underneath a structure where you can't see it?


100% sure that no copy is buried within the VI anywhere.

 

 

Iam aware of the facts about case structure....my problem is that the behaviour doesnt comply with it and i am facing problem in my application that iam developing.

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
Download All
0 Kudos
Message 6 of 9
(3,682 Views)

There is an add.vi in vi.lib:

C:\Program Files\National Instruments\LabVIEW 8.6\vi.lib\Analysis\Matrix\Support\Methods\Numeric.llb\add.vi

 

Maybe that one is loaded?

 

I would check the path of the loaded VI

 

Ton 

Message Edited by TonP on 01-07-2009 08:15 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 7 of 9
(3,650 Views)
Solution
Accepted by topic author JK1

I see the behavior he is describing.  I went back to 8.0 and see this behavior.  The documentation you linked to is a bit misleading in places and flat out wrong in others.  If you build your VI into an EXE, it will behave as you expect.  I think "compiling" in the links is going back and forth between LabVIEW compiling source code to run in LabVIEW and LabVIEW compiling (building) source code into an EXE.

 

In 8.0 the case structure with a constant wired to it does not work in LabVIEW or EXE.  In 8.2 and later it will work in an EXE.  In all versions of 8.x, the diagram disable structure will take the VI out of memory in the EXE.

 

So, the devloper zone article is confusing and wrong in some places, as all of this only works when the VI is built into an EXE.

Message 8 of 9
(3,626 Views)

Hai Matthew Kelton,

 

I tried the activity by building it to exe and it works!!!! you are absolutely correct and all the said behaviour can be observed only in exe rather in source code.

Thank you very much for your valueble response.

 

 

Message Edited by JK1 on 01-07-2009 02:32 AM
With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 9 of 9
(3,613 Views)