BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

Interesting constructs found in:
 
(A) Here we spin a loop at double-speed doing nothing but writing local variables to their own terminal (Reminds me of C programming). 😉 The LabVIEW equivalent of a short circuit! If we would delete that loop and delete all the local variables in it, nothing (nothing!!!) would change (except better performance and cleaner diagram).
(B) Here we spin a loop updating a chart every 500ms. If we would eliminate that loop and place the bundle in the other loop at (C), it would update at the same rate, exactly!.
(C) See (B)
(D) Since we have all these extra loops, we cannot use a latch action boolean, so let's do something funky! Interestingly, the actual stop button wire is not even used anywhere.
 
All the big loops needs is a few shift registers containg arrays.
 
 
 
 

Message Edited by altenbach on 09-17-2007 05:41 PM

Message 81 of 2,565
(28,635 Views)

that one is a beauty 🙂

isnt it there a very bad race condition in (C), (values in the case structure vs out)

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
Message 82 of 2,565
(28,588 Views)
Yes, the "tanks" should be in shift registers and the chart outside the case if it should get updated even if there is no new data (functionality of the original code)
 
Not really a race condition, though (if I understand you right). We have only a single writer in the main loop and the chart is simply asynchronous. Things will be in the right order in all cases. 😉
Message 83 of 2,565
(28,553 Views)
i was assuming the other cases also has same locals, with different inputs. i played long ago with similar configuration, (LV5 tough), and found out that depending on the case chosen ( and actually the position of the locals within the cases 🙂 ), the write would be before or after the read just after the case structure. that would totally destroy the order (altough keep a pattern Smiley Very Happy ).
maybe i will try that again...
-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
Message 84 of 2,565
(28,542 Views)


@Gabi1 wrote:

isnt it there a very bad race condition in (C), (values in the case structure vs out)


Ah, now I see it! I thought you were talking about the big case structure.!

Yes, you are absolutely correct. 🙂 There is no guarantee that these green locals going to the subVI are read after they get updated in the small case structure. Most likely, they get read even before the small case executes, thus calling the subVI with stale values. 🙂

Message 85 of 2,565
(28,541 Views)

(Adapted from: http://forums.ni.com/ni/board/message?board.id=170&message.id=273436#M273436)

There are many ways to concatenate the elements of a string array.

  1. Some involve FOR loops, an initialized shift register and other trimmings.
  2. Some just use a simple atomic operation. 🙂

Message Edited by altenbach on 09-21-2007 11:27 AM

Message 86 of 2,565
(28,507 Views)

i did not expect to see that one!

remark, one could have understood the dynamic to double to dynamic, as a result of several iterations of testing, but the double to double ?

edit: source thread

Message Edited by Gabi1 on 09-28-2007 05:14 PM

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
Message 87 of 2,565
(28,438 Views)
One very late night of coding, several years ago, having had the program "blow up" several times during testing, I created an icon for the top level vi that was a picture of the U.S.S. Maine on a fateful night in Havana harbor.  It is probably still there (the icon). 
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 89 of 2,565
(28,380 Views)
The hard way to negate:


From http://forums.ni.com/ni/board/message?board.id=170&message.id=277103#M277103

Message Edited by smercurio_fc on 10-10-2007 12:01 PM

Message 90 of 2,565
(28,314 Views)