Jump to content


Photo
- - - - -

Shift register terminals as default for error clusters and reference


  • Please log in to reply
16 replies to this topic

#1 Jim Kring

Jim Kring

    packages everywhere!

  • JKI
  • 1,901 posts
  • Location:Lafayette, CA
  • Version:LabVIEW 2011
  • Since:1995

Posted 21 November 2007 - 06:21 PM

QUOTE(Tomi Maila @ Nov 20 2007, 03:46 AM)

When wiring error into a loop, the most common use case is to have a shift register to pass the error from iteration to iteration. Hence shift registers should be the default terminal type for error clusters when wired to a loop.


And refnums, too :)

#2 Jim Kring

Jim Kring

    packages everywhere!

  • JKI
  • 1,901 posts
  • Location:Lafayette, CA
  • Version:LabVIEW 2011
  • Since:1995

Posted 21 November 2007 - 06:21 PM

QUOTE(Tomi Maila @ Nov 20 2007, 03:46 AM)

When wiring error into a loop, the most common use case is to have a shift register to pass the error from iteration to iteration. Hence shift registers should be the default terminal type for error clusters when wired to a loop.


And refnums, too :)

#3 Jim Kring

Jim Kring

    packages everywhere!

  • JKI
  • 1,901 posts
  • Location:Lafayette, CA
  • Version:LabVIEW 2011
  • Since:1995

Posted 21 November 2007 - 06:21 PM

QUOTE(Tomi Maila @ Nov 20 2007, 03:46 AM)

When wiring error into a loop, the most common use case is to have a shift register to pass the error from iteration to iteration. Hence shift registers should be the default terminal type for error clusters when wired to a loop.


And refnums, too :)

#4 MikaelH

MikaelH

    The 500 club

  • Premium Member
  • 576 posts
  • Location:Sydney
  • Version:LabVIEW 2012
  • Since:1996

Posted 21 November 2007 - 06:36 PM

QUOTE(Jim Kring @ Nov 21 2007, 07:00 AM)

And refnums, too :)


But refnums of cause only need a shift register when you're using a for loop (to solve the issue when N=0).
//Mikael

Posted Image


#5 MikaelH

MikaelH

    The 500 club

  • Premium Member
  • 576 posts
  • Location:Sydney
  • Version:LabVIEW 2012
  • Since:1996

Posted 21 November 2007 - 06:36 PM

QUOTE(Jim Kring @ Nov 21 2007, 07:00 AM)

And refnums, too :)


But refnums of cause only need a shift register when you're using a for loop (to solve the issue when N=0).
//Mikael

Posted Image


#6 ned

ned

    Extremely Active

  • Members
  • PipPipPipPip
  • 394 posts
  • Location:Menlo Park, CA
  • Version:LabVIEW 2009
  • Since:1999

Posted 21 November 2007 - 06:38 PM

QUOTE(Jim Kring @ Nov 20 2007, 03:00 PM)

And refnums, too :)

Why would you need refnums to be shift registers? Unless you're closing the reference within the loop and replacing it with a not-a-refnum constant, I'd expect they would pass through a loop unmodified, and I don't think there would be a benefit to using a shift register over a tunnel (although I don't think there would be a disadvantage, either, which might be enough to make your point).

#7 ned

ned

    Extremely Active

  • Members
  • PipPipPipPip
  • 394 posts
  • Location:Menlo Park, CA
  • Version:LabVIEW 2009
  • Since:1999

Posted 21 November 2007 - 06:38 PM

QUOTE(Jim Kring @ Nov 20 2007, 03:00 PM)

And refnums, too :)

Why would you need refnums to be shift registers? Unless you're closing the reference within the loop and replacing it with a not-a-refnum constant, I'd expect they would pass through a loop unmodified, and I don't think there would be a benefit to using a shift register over a tunnel (although I don't think there would be a disadvantage, either, which might be enough to make your point).

#8 Tomi Maila

Tomi Maila

    The 500 club

  • JKI
  • 841 posts
  • Location:San Francisco
  • Version:LabVIEW 8.6
  • Since:2004

Posted 21 November 2007 - 06:42 PM

QUOTE(ned @ Nov 20 2007, 10:17 PM)

Why would you need refnums to be shift registers? Unless you're closing the reference within the loop and replacing it with a not-a-refnum constant, I'd expect they would pass through a loop unmodified, and I don't think there would be a benefit to using a shift register over a tunnel (although I don't think there would be a disadvantage, either, which might be enough to make your point).

Because if for loop is never executed (N=0), the reference is not passed trough the loop, but a default NULL reference is returned at the other end of the loop instead.

Tomi

#9 Tomi Maila

Tomi Maila

    The 500 club

  • JKI
  • 841 posts
  • Location:San Francisco
  • Version:LabVIEW 8.6
  • Since:2004

Posted 21 November 2007 - 06:42 PM

QUOTE(ned @ Nov 20 2007, 10:17 PM)

Why would you need refnums to be shift registers? Unless you're closing the reference within the loop and replacing it with a not-a-refnum constant, I'd expect they would pass through a loop unmodified, and I don't think there would be a benefit to using a shift register over a tunnel (although I don't think there would be a disadvantage, either, which might be enough to make your point).

Because if for loop is never executed (N=0), the reference is not passed trough the loop, but a default NULL reference is returned at the other end of the loop instead.

Tomi

#10 ned

ned

    Extremely Active

  • Members
  • PipPipPipPip
  • 394 posts
  • Location:Menlo Park, CA
  • Version:LabVIEW 2009
  • Since:1999

Posted 21 November 2007 - 07:07 PM

QUOTE(Tomi Maila @ Nov 20 2007, 03:21 PM)

Because if for loop is never executed (N=0), the reference is not passed trough the loop, but a default NULL reference is returned at the other end of the loop instead.

Tomi

Ah, right. I've been bitten by that one before, and now my solution is usually to fork the wire outside the for loop.

#11 ned

ned

    Extremely Active

  • Members
  • PipPipPipPip
  • 394 posts
  • Location:Menlo Park, CA
  • Version:LabVIEW 2009
  • Since:1999

Posted 21 November 2007 - 07:07 PM

QUOTE(Tomi Maila @ Nov 20 2007, 03:21 PM)

Because if for loop is never executed (N=0), the reference is not passed trough the loop, but a default NULL reference is returned at the other end of the loop instead.

Tomi

Ah, right. I've been bitten by that one before, and now my solution is usually to fork the wire outside the for loop.

#12 silmaril

silmaril

    Very Active

  • Members
  • PipPipPip
  • 111 posts
  • Location:Munich
  • Version:LabVIEW 2011
  • Since:2001

Posted 24 November 2007 - 06:35 AM

QUOTE(Tomi Maila @ Nov 20 2007, 12:46 PM)

When wiring error into a loop, the most common use case is to have a shift register to pass the error from iteration to iteration. Hence shift registers should be the default terminal type for error clusters when wired to a loop.

EDIT: The same should apply for all reference types.

I agree absolutely.

Did you already suggest this on NI's site?

#13 silmaril

silmaril

    Very Active

  • Members
  • PipPipPip
  • 111 posts
  • Location:Munich
  • Version:LabVIEW 2011
  • Since:2001

Posted 24 November 2007 - 06:35 AM

QUOTE(Tomi Maila @ Nov 20 2007, 12:46 PM)

When wiring error into a loop, the most common use case is to have a shift register to pass the error from iteration to iteration. Hence shift registers should be the default terminal type for error clusters when wired to a loop.

EDIT: The same should apply for all reference types.

I agree absolutely.

Did you already suggest this on NI's site?

#14 Tomi Maila

Tomi Maila

    The 500 club

  • JKI
  • 841 posts
  • Location:San Francisco
  • Version:LabVIEW 8.6
  • Since:2004

Posted 24 November 2007 - 12:02 PM

QUOTE(silmaril @ Nov 23 2007, 10:14 AM)

Did you already suggest this on NI's site?

I just did.

#15 Tomi Maila

Tomi Maila

    The 500 club

  • JKI
  • 841 posts
  • Location:San Francisco
  • Version:LabVIEW 8.6
  • Since:2004

Posted 24 November 2007 - 12:02 PM

QUOTE(silmaril @ Nov 23 2007, 10:14 AM)

Did you already suggest this on NI's site?

I just did.

#16 rolfk

rolfk

    LabVIEW Aficionado

  • Premium Member
  • 2,050 posts
  • Location:Netherlands
  • Version:LabVIEW 2011
  • Since:1992

Posted 30 November 2007 - 09:17 AM

QUOTE(ned @ Nov 20 2007, 03:17 PM)

Why would you need refnums to be shift registers? Unless you're closing the reference within the loop and replacing it with a not-a-refnum constant, I'd expect they would pass through a loop unmodified, and I don't think there would be a benefit to using a shift register over a tunnel (although I don't think there would be a disadvantage, either, which might be enough to make your point).


Another reason (except the N=0 issue which I think was changed at some point around 7.x) is that wiring the refnum out of the loop defaults to autoindexing for the for loop which is almost never what it should do. Using shift registers solves that too.

Rolf Kalbermatter

#17 orko

orko

    The 500 club

  • JKI
  • 577 posts
  • Location:Tulsa, OK
  • Version:LabVIEW 2012
  • Since:2005

Posted 05 December 2007 - 03:56 PM

QUOTE(Tomi Maila @ Nov 20 2007, 03:46 AM)

When wiring error into a loop, the most common use case is to have a shift register to pass the error from iteration to iteration. Hence shift registers should be the default terminal type for error clusters when wired to a loop.

EDIT: The same should apply for all reference types.


I can't count how many times I've pointed out a tunneled error cluster in a co-worker's code and each time it's the same response -- "Ack! I forgot about that..."

The majority of times, a shift register is definitely the right choice, so I agree totally it should be the default.

PS. Sometimes I am the co-worker :laugh:
Joe "orko" Sines