LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change tunnel mode

Solved!
Go to solution

I have an array which I'm using to save 3 boolean values.  I used a probe to check and right before I enter the case structure, I have 3 values (TTF).  I also have 3 values after I enter the case strucutre (TTF).  However, once I enter the for loop, I only get the last value.  I want to change the tunnel mode to indexing but when I right click on the box that I outlined in red, there's no option.  How can I change it so that all three values enter the for loop?

 

Thank you. 

Download All
0 Kudos
Message 1 of 29
(6,109 Views)

You will have True on the first iteration, True on the second iteration, False on the third and final iteration.  The box you show is already set for auto-indexing.

 

(PS.  Did you know that something equal to True will always return the original result?  Comparing something to True is a Rube Goldberg construction.)

 

There are a lot of other odd constructions in your VI.  Initializing a boolean array, putting it in a shift register to never be used again, other than replacing each element with the value from a button.  Just build an array of the buttons!  Also, building an array of zeroes and using a shift register to build an array of new data.  But sending the latest 100 points to a waveform chart every iteration.  Building the array is fine, it will keep a history of data for you.  But the waveform chart also maintains a history.  So if you send old data into a waveform chart, you are getting an ever duplicated version of histories.)

 

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

Message 2 of 29
(6,096 Views)

Hi RavensFan,

 

I think it's set to last value because I get the last value every time.

0 Kudos
Message 3 of 29
(6,093 Views)

No. You only see the last value because it loops through the others in microseconds. Try running the VI with Execution Highlighting (the light bulb icon on the block diagram toolbar) turned on.

 

Lynn

0 Kudos
Message 4 of 29
(6,082 Views)

No.  It is set to Auto-Indexed tunnel which the [ ] symbol tells me.  And when you hover over the tunnel, it even says "Auto-Indexed Tunnel".  Why do you think it only gives the last value?

 

Have you tried running your code with Highlight Execution on to study how the data flows?

 

Also, the stacked sequence serves no purpose.  In frame zero you are writing data to a global, just to read the data from the global in frame 1.  Get rid of the stacked sequence and the globals and use wires from the Simulate Signal to the code in frame 1.

0 Kudos
Message 5 of 29
(6,077 Views)
Why do you say that? A simple probe inside case 0 and case 1 should show the first two elements.

There are other strange parts of your code. A stacked sequence and local variables should be avoided. Do not wire N and auto-index. Avoid the evil dynamic data.
0 Kudos
Message 6 of 29
(6,076 Views)

Do you know what this does?  What do you want it to do?

 

Merge?.png

 

I did not know so I wrote a little test VI with two numeric controls and a numeric indicator to test it.

 

Although that node is called Merge Signals, when used with two scalars like this and driving an output scalar sink, only the top input signal appears at the output. If the DDT signal is wired to a chart, both signals are present.

 

Another example of what Dennis rightly calls the evil DDT.

 

Lynn

Message 7 of 29
(6,055 Views)

Thank you everyone for your input.  I'm a total beginner so it's going to take me some time to understand everyone's comments.

 

@RavensFan - what do you mean by building an array of buttons?  I thought that's what I'm doing here.  Also, if the waveform chart maintains a history, does that mean I don't need an array?  The reason I built that array is to ensure that there are 100 points constantly being displayed. 

The stacked sequence is there because this VI is just a sample, but eventually I'll be using live data so I thought it would be a good idea to write my data to global variables in a different frame then the frame where the execution is actually happening.  Should I just do everything in one frame?

 

@johnsold - I tried running the VI with Execution Highlighting (didn't even know that was a thing!) and I was able to see that I dont' only get the last value.  Thank you for that helpful tip!

The screenshot you pasted: when a boolean button is pressed and the condition is True, the signal generated from the global varible should be merged with the data already saved in the shift register and then displayed on the chart so that's it continuous.  I'm guessing this is incorrect (though I do want both signals to be displayed).

 

@Dennis_Knutson - Which local variables are you refering and why should they be avoided?  Also, where did I wire N and auto-index and why shouldn't that be done?  Finally, what's so bad about dynamic data?

 

Thank you again everyone!  This is very useful stuff.

 

0 Kudos
Message 8 of 29
(5,992 Views)

@rhupd wrote:

Thank you everyone for your input.  I'm a total beginner so it's going to take me some time to understand everyone's comments.

 

@RavensFan - what do you mean by building an array of buttons?  I thought that's what I'm doing here.  

No, you are replacing the elements of an array with the button values.  Just use Build Array.

 

 

Also, if the waveform chart maintains a history, does that mean I don't need an array?  The reason I built that array is to ensure that there are 100 points constantly being displayed.

Correct. You can set the history of the waveform chart to be 100 points by right clicking on it.

 

The stacked sequence is there because this VI is just a sample, but eventually I'll be using live data so I thought it would be a good idea to write my data to global variables in a different frame then the frame where the execution is actually happening.  Should I just do everything in one frame?

Not a good idea.  Stacked sequences are frowned upon because they hide code.  You can right click on it and pick replace with flat sequence structure.  Then you can right click on that and pick Remove sequence structure.  You can actually do what you want in ZERO frames.

 

 

@Dennis_Knutson - Which local variables are you refering and why should they be avoided?  Also, where did I wire N and auto-index and why shouldn't that be done?  Finally, what's so bad about dynamic data?

It hides any information about the actual underlying data.  It is a magical wire that often allows you to connect things together that perhaps shouldn't be wired together.  It could be a single value, it could be an array of single values from different channels.  It could be an array of values from a single channel, it could be an array of multiple values from multiple channels.  It can be a waveform or an array of waveforms.  It lets you connect stuff together, but you might be coercing an array into a single value (the first, or last value of the array and discarding all the rest) without you even realizing.  "Yeah!!! No broken run arrow!!! But why doesn't my code work like I think it should??"

 

 

(Moved down because explanation is based on above paragraph)

@johnsold - I tried running the VI with Execution Highlighting (didn't even know that was a thing!) and I was able to see that I dont' only get the last value. Thank you for that helpful tip!

Take tutorials. I'm sure Highlight Execution is very early on in instruction on how to debug LabVIEW

 

The screenshot you pasted: when a boolean button is pressed and the condition is True, the signal generated from the global varible should be merged with the data already saved in the shift register and then displayed on the chart so that's it continuous. I'm guessing this is incorrect (though I do want both signals to be displayed).

The dynamic datatype is lying to you like stated above.  You are merging two single scalars into a dynamic datatype.  (Probably 1 value 2 channels.)  But then that blue wire is being coerced to a scalar datatype (so probably only the 1 value from the first channel is actually leaving the case structure.)   Why does it coerce?  Your other cases already defined that the outgoing wire should be a scalar.


 

Message 9 of 29
(5,982 Views)

Thank you very much for your help!!  I think I was complicating things unnecessarily.

 

Can you please look at the attached VI?  The three individual charts are being controlled by the boolean buttons but I still can't figure out how to put all three signals on one chart.  Also, when I unclick a Boolean button, is there a way to make the graph disappear? I only want it on the chart when the button is pressed.  

0 Kudos
Message 10 of 29
(5,974 Views)