viSci Posted December 20, 2008 Report Share Posted December 20, 2008 I recall that we used to just place such a vi in a the non-executing state of a True/False case structure, but LV seems bent on optimizing out this 'non-running' code. I had to be creative to fool it. Just curious what others have found. Quote Link to comment
Phillip Brooks Posted December 20, 2008 Report Share Posted December 20, 2008 I'm upgrading a bunch of 7.0 code to 8.6. When I load a 7.0 VI that uses a case structure with a constant on the block diagram to disable code, LabVIEW converts the constant to a hidden control and reports a warning while opening. I think a constant causes the contents of the unused case to be optimized "out". If you're creating a new VI in 8.6 and have used a constant, maybe converting it to a hidden control will help... Quote Link to comment
Antoine Chalons Posted December 20, 2008 Report Share Posted December 20, 2008 QUOTE (Phillip Brooks @ Dec 19 2008, 03:00 PM) I'm upgrading a bunch of 7.0 code to 8.6. When I load a 7.0 VI that uses a case structure with a constant on the block diagram to disable code, LabVIEW converts the constant to a hidden control and reports a warning while opening.I think a constant causes the contents of the unused case to be optimized "out". If you're creating a new VI in 8.6 and have used a constant, maybe converting it to a hidden control will help... I noticed that as well and was not really creative, I make boolean controls and hide them ; I also enabled the "show constant folding" options to get this : http://lavag.org/old_files/monthly_12_2008/post-7452-1229695511.png' target="_blank"> Quote Link to comment
crelf Posted December 20, 2008 Report Share Posted December 20, 2008 QUOTE (sachsm @ Dec 19 2008, 08:50 AM) I recall that we used to just place such a vi in a the non-executing state of a True/False case structure, but LV seems bent on optimizing... Yep - this optimization was introduced in 8.0. Quote Link to comment
asbo Posted December 20, 2008 Report Share Posted December 20, 2008 Disable structures work great for this. Quote Link to comment
Antoine Chalons Posted December 20, 2008 Report Share Posted December 20, 2008 QUOTE (asbo @ Dec 19 2008, 04:37 PM) Disable structures work great for this. With LV 8.0 I remember having some troubles with the disable diagram structure. Code was executing quite slower and I had some issues when building applications, maybe these issues have been fixed since then though.. Have you ever had these problems ? Quote Link to comment
crelf Posted December 20, 2008 Report Share Posted December 20, 2008 QUOTE (asbo @ Dec 19 2008, 10:37 AM) Disable structures work great for this. Right - but code in the disable structures is discarded at compile time. QUOTE (Antoine Châlons @ Dec 19 2008, 10:47 AM) Code was executing quite slower and I had some issues when building applications, maybe these issues have been fixed since then though.. Have you ever had these problems ? Nope - I have no issues when using the diagram or conditional diagram disable structures. Quote Link to comment
Neville D Posted December 20, 2008 Report Share Posted December 20, 2008 QUOTE (Antoine Châlons @ Dec 19 2008, 07:47 AM) With LV 8.0 I remember having some troubles with the disable diagram structure.Code was executing quite slower and I had some issues when building applications, maybe these issues have been fixed since then though.. Have you ever had these problems ? Code runs fine in LV 8.5.1 and 8.6 and under RT as well for both versions with diagram disable. I have a strange bug where one of the IMAQ VI's causes an RT build to fail, so I have diagram disabled that VI (since it is not used currently in the code). Bug has been reported to NI. N. Quote Link to comment
jpdrolet Posted December 20, 2008 Report Share Posted December 20, 2008 QUOTE (sachsm @ Dec 19 2008, 09:50 AM) I recall that we used to just place such a vi in a the non-executing state of a True/False case structure, but LV seems bent on optimizingout this 'non-running' code. I had to be creative to fool it. Just curious what others have found. You can also put the VI in a static VI Refnum. Quote Link to comment
Aristos Queue Posted December 21, 2008 Report Share Posted December 21, 2008 QUOTE (sachsm @ Dec 19 2008, 07:50 AM) I recall that we used to just place such a vi in a the non-executing state of a True/False case structure, but LV seems bent on optimizingout this 'non-running' code. I had to be creative to fool it. Just curious what others have found. The canonical solution is the static VI reference, introduced in the same version that the case structure optimizations went in. And, for the record, if you change the constant to a control then LV won't optimize it out -- at least, not in any version of LV that has shipped yet. It is entirely possible that LV could decide in a built application, where the Front Panel has been stripped out, if the bool is not on the conpane, then the case structure could be optimized. Not that I'm saying that change is coming... I'm just saying that you probably want to use a static VI reference. Quote Link to comment
Phillip Brooks Posted December 22, 2008 Report Share Posted December 22, 2008 QUOTE (Aristos Queue @ Dec 20 2008, 03:38 PM) The canonical solution is the static VI reference, introduced in the same version that the case structure optimizations went in.And, for the record, if you change the constant to a control then LV won't optimize it out -- at least, not in any version of LV that has shipped yet. It is entirely possible that LV could decide in a built application, where the Front Panel has been stripped out, if the bool is not on the conpane, then the case structure could be optimized. Not that I'm saying that change is coming... I'm just saying that you probably want to use a static VI reference. I don't know how to tag your post, but I feel compelled to do so... Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.