LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tunnel vs. shift register

Hi,

 

I am curious and basic question on the difference between tunnels and  shift register.

Do you know the difference of memory or performance between them?

 

I had some strange experience in file reference.

Sometimes, tunnel showed lost of reference but shift register resolved this trouble.

 

In principle, I think they are the same if the connection is guaranteed. Is it right?

 

labmaster.

0 Kudos
Message 1 of 7
(10,028 Views)

Where you would have had your issue is with a 0 iteration FOR loop.  This most commonly happens with autoindexing and the array is empty.

 

Each tunnel is its own memory location.  So if you do have the 0 iteration FOR loop, the default value of the data type will be the output.  In the case of your references, this would cause you to lose your reference.

 

A shift register has the same memory location on the input and output of the loop.  So if you initialize the shift register and you iterate 0 times with your FOR loop, what you initialize the shift register to is what will come out.  This means you will retain your reference.

 

This is a very common issue.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 7
(9,999 Views)

Thanks for the reply.

What do you mean "0 iteration for loop"? Is the attachment what you mean?

When do you use this kind of loop?

 

labmaster

0 Kudos
Message 3 of 7
(9,990 Views)

No. They are not the same. With a shift register you can permanently store values at runtime because

it passes the value from one loop run to the next. of course you have to wire the input (left shift reg to

the right shift because else you pass the default value to the next loop run) 

F.e. a functional global variable consists of a while loop(with true wired to the stop cutton) and a shift register which stores

a value.  

With a tunnel you must decide if you want to pass the value from the last loop run outside or the complete array of values.

The input terminal passes the default value inside the loop if not wired or the wired value. the value will not be stored from one

loop run to the next.

 

 

0 Kudos
Message 4 of 7
(9,988 Views)

Labuser16383, I agree with your opinion.

However, I didn't indicate I mean when the value is not changed and just be transmit with the inital value in whole loop like some reference like in my queue example.

0 Kudos
Message 5 of 7
(9,979 Views)

labmaster wrote: When do you use this kind of loop?

Rarely ever on purpose.  Like I said, it usually happens due to autoindexing on an array that is empty, either due to an error or the user forgot to fill in the array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(9,975 Views)

FOR loop + reference + tunnel can be very dangerous ! See here.

0 Kudos
Message 7 of 7
(9,970 Views)