01-14-2017 11:21 AM - edited 01-14-2017 11:33 AM
Yes, to make them equivalent (not verified!), the lower one should also use a constant. 😄
01-14-2017 11:29 AM - edited 01-28-2017 02:19 PM
From the deeeply stacked multiframe stacked sequences and the overall diagram size, this program was clearly developed on a 640x480 monitor, so that's the excuse for that!
Inexcusable is the unmaintainable code. For example there is a hardwired path diagram constant that exists in several (at least 3, but try to find them!) locations. Since the path value is the problem, identical changes need to be made in three different locations and flipping through all the sequence frame would make it easy to miss one. Then we have that double-built array seen in the upper part of the image, which seems pure rube goldberg. There are plenty of other curiosities, so this is just the tip of the iceberg. For example, with every iteration of the inner loop, it appends the new data to a spreasheet file in the above seen frame and in the next frame it reads the exact same entire file twice in parallel in order to extract different columns for each instance (see below). I don't think "index array" was resizeable back then, so the multiple instances of that are excused.
01-14-2017 12:18 PM
There is Elapsed Time right there in the image. so at least LabVIEW 7Express. The index array is resizable But, that growable node feature never made the training material. Its a possibly forgivable mistake.
01-14-2017 12:23 PM
I think the code is probably much older. Maybe the elapsed time was added in a later revision.
01-14-2017 01:14 PM
@altenbach wrote:
I think the code is probably much older. Maybe the elapsed time was added in a later revision.
Possibly, there apperas to be an "Altenbach True" constant as well
01-14-2017 01:24 PM
Well, these get updated if you open in a newer version. 😄
01-14-2017 01:41 PM
Yes, I just read the linked post ported from Version 2006??? to 2013 (Year 2006 was Ver 8.20) but some things (GPIB488.2 calls for one) tell me it was sourced a lot earlier.
Ass for the write to file and read back- Well the file needs to be written of course, and reading it back that way saves a "Transpose Array" on the 2D DBL as well as performing rounding to the 7th significant digit
01-14-2017 02:00 PM - edited 01-14-2017 02:00 PM
Maybe building the data array for the xy graphs in memory was too taxing on the 128k macintosh. 😄
02-17-2017 02:16 PM
I've only been using LabView for about 8 months, and yesterday I was given another person's code so I can understand it and then make it better/adjust it for our needs. Today I took a closer look and found a bunch of stuff. Being new though, I have to ask is there something I'm missing? Are these old school techniques or is there actually some purpose to these that I'm missing? But anyway, first example:
And yes that is connected to a for loop counter. That's a very common technique in this code. I counted SEVENTEEN buttons that when pressed, activate 1 iteration of a for loop. Why not just use a case structure?
This one confused me so much that I had to make a test program to make sure my logic is right (the boolean wire goes directly to the shift register on the right). So if true, make sure it's not false, and continue. And yes, the case structure activates 1 iteration of a for loop.
Other things I've found:
1) There are also 23 (at least) flat sequence structures, two of them were just a single frame, and a section has 4 nested flat sequences.
2) 15 (at least) parallel while loops. Most of them can be combined.
3) For loops autoindexing an array of 5 strings, but with a loop counter of 5.
I've definitely done some Rube Goldberg code (I've even done the case structure "if true output true") but it's heartwarming looking at someone's code who's much more advanced then me and finding their weird stuff.
02-17-2017 02:49 PM
For the first, a 0 iteration for loop outputs default data ftor the type of any output tunnels. I'm not saying that that is why that construct is used but, it is a difference between that and a case structure.
EX 2 is a "Has Changed?" construct. (usually uses a Feedback node for readability and initialization options) A value changed event and a decient design pattern (P-C-Events) would be more robust usually.
Others Flat Seq Structures are usually for data flow. Proper sub-vi construction usually makes them less needed but, they are not evil. Nesting them 4 deep sounds like a maint "Knight"mare. I hope they are commented. Be careful what you mean by Parrallel For Loops - Independant loops that are running asynchronus to each other may have uses depending on what they are doing and scaleability of unrelated parameters. (Not saying if that is the case here either.) Autoindex or wire N is much more common but, there are cases wher you may want to auto-index over a sub-set of an array.
Most likely you ran into code that should be fixed to be more robust, scaleable and readable. Welcome to our world! (Yes, I swim it that pool a lot)