LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform palette "What?"s

Every time I look inside the VIs in Waveform palette I wonder - what are the "decisions behind the design" there? There are many surprising parts of code, and as I don't like what I don't understand - here are some questions for all of LV-gurus and R&D-ers around.

 

Lets take a look at Get Waveform Time Array:

Get Waveform Time Array.png

What is the purpose of Always Copy there? Is it some kind of bug fix from the times when quick drop wasn't present even in textual languages? Do we get some magic performance boost by putting it there? Should I put Always Copy on every timestamp wire I have and then it would protect me from spaghetti 'till the end of my days? Questions are rising...

 

Always Copy is omni-present in this palette. But even more interesting is how carelessly this palette treat my data, which I acquired with my own blood, tears and sweat... Lets take a look at Scale Delta t:

Scale Delta t.png

 

OK, now this is simple: if there is no error, just scale dt. But if there is error, just throw away all the data and return empty waveform. Loosing all data just because there is error somewhere seems like pretty harsh punishment for programmer here... Of course, this behaviour is not documented in any way, so you need to look inside this VI to see where your data went.

 

And then there is Get Waveform Duration:

Waveform Duration.png

 

If there is no error, just calculate this duration... But remember to always copy the dt!? And then ctrl+scroll to Error case and... Take value of dummy, hidden, empty Waveform ERROR control on front panel, ALWAYS COPY its value and return. Hey! There's error on the wire! You didn't really need this data! Also, you get freshly copied empty waveform here instead, so stop complaining!

 

Jokes aside - is there any logical explanation to the extensive usage of Always Copy and throwing data away when there is error passing in this palette?

Message 1 of 3
(3,075 Views)

Yup, I've done some research before I posted this and seen most of this "Lets-Save-The-Code-By-Always-Copy" threads (and I undestand that no-one never had better idea to use it than "") )  😉 However, some of the places where it is used in Waveform palette, such as copying dt in Waveform Duration, is just weird. I can imagine that forcing copy of t0 before shift register in Get Waveform Time Array could kick compiler back in the old days, but the copy of double before simple multiplication? That's strange.

I'm just wondering, out of pure curiosity, what caused someone to write this code. Maybe there is someone from R&D who remember writing/patching this library, who could answer? 😉

0 Kudos
Message 3 of 3
(3,053 Views)