From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Value changes after it goes through case structure tunnel

LoL, yes, I didn't even bother trying to decipher the diagram, but now that I'm looking at it again, there certainly is a whole bunch of weird boolean and local "magic" going on that could cause race conditions which could create un-expected behavior... in this case, thats a lot more likely to be the case than a one in a million (or 10) bad library link caused by random fluke accident during a software upgrade..

QFang
-------------
CLD LabVIEW 7.1 to 2016
0 Kudos
Message 11 of 24
(586 Views)

Again with the picture it is hard to tell what is going on.  The =True or =False constructs are unneccessary and distracting perhaps, but not an issue as far as I can tell.  My question is what makes you think the case is still executing?  It seems to me the probes inside the True case all show up as 'No Debug Info' meaning they have not been executed.

 

I suggest turning on Execution Highlighting to see what is going on.

0 Kudos
Message 12 of 24
(581 Views)

Unfortunately it didn't work for me... I dragged everything out and deleted the case structure. Created a new one from the pallete, re atached the case and dragged everything back in again. It still runs the true case all the time. Another interesting thing to note is that even if I make the case false it still refuses to do nothing... In essence it seems to have a problem with doing nothing, regardless of whether its true or false..

0 Kudos
Message 13 of 24
(580 Views)

@Darin.K wrote:

Again with the picture it is hard to tell what is going on.  The =True or =False constructs are unneccessary and distracting perhaps, but not an issue as far as I can tell.  My question is what makes you think the case is still executing?  It seems to me the probes inside the True case all show up as 'No Debug Info' meaning they have not been executed.

 

I suggest turning on Execution Highlighting to see what is going on.


I thought the same thing.  I reread his post and he said breakpoint, not probe.  You can see the breakpoint on the divide in the top left of the case structure being activated.  Curious though that Probe 13 says no data.

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 14 of 24
(575 Views)

Sorry not sure how to quote on this, @Darin.K

 

Yes in the probe window it shows 'no debug info' because I set the breakpoint on the first division, so I'm guessing the execution didn't get to those wires yet. I will turn on Execution Highlighting, sounds like it will be useful, I didn't know that was available.

 

I'm new to labview, some of the boolean operations are unneccesary but its just so I could follow my own wierd way of thinking about things. I plan to clean it up later. I have had the feeling I've been overusing local variables but I don't see how I can get around it 😕

0 Kudos
Message 15 of 24
(570 Views)

overuse of local variables is probably one of, if not the most common beginner issue in LabVIEW.

 

A lot of times you can get around using locals simply by stringing the wire along... but that could create a mess right? -Thats were organizing your code and creating well defined sub-vi's help out some. Functional Globals and experience will get you even further. If at all possible, you would probably benefit a lot from Core 1 and/or Core 2 as both of these (and Core 2 in particular) aims to set you up on how to do code in a way that you don't depend on locals all the time. 🙂 Failing that, the forum and example projects shipping with LabVIEW and time will get you there too.

 

QFang
-------------
CLD LabVIEW 7.1 to 2016
Message 16 of 24
(555 Views)

I'll have a try at structuring my code better.

 

I still can't seem to fix the problem of this case structure... Like I said even if I switch the cases around the program just runs the case with code inside it, it has a problem with doing nothing, any suggestions?

0 Kudos
Message 17 of 24
(544 Views)

Try deleting the wire that goes to your case selector, then right click on the case selector and choose "create  constant". Pick the constant of the "do nothing case" and run.. there is no way it should run any other case but the "do nothing case" .... can you try that and report back? (Of course, after you can delete the constant and wire your original boolean wire back to the case).

QFang
-------------
CLD LabVIEW 7.1 to 2016
0 Kudos
Message 18 of 24
(535 Views)

Done. It astonishingly ran the true case 😛

 

Picture attached. I attached the VI just incase you have enough time on your hands to have a look.

 

Download All
0 Kudos
Message 19 of 24
(528 Views)

It just struck me that you are running that case structure inside a simulation loop.  I have very limited experience with this, but I do remember some "unusual" behavior.  If I am not mistaken, it is only a recent development that you are even allowed to put a Case structure directly inside the simulation loop.

 

Long story short, for some reason that now escapes me, all cases of a case structure are executed during the first and last cycles of the simulation loop.  I believe things will be more normal if you encapsulate the case structures inside subVIs.  I remember when I was evaluating the CDS toolkit I reached the point (in a similar quirky situation) where I could either abandon ship or read the manual.  I chose the former.

Message 20 of 24
(508 Views)