08-25-2020 03:59 AM - edited 08-25-2020 04:02 AM
Hi Gerd,
@GerdW wrote:
Hi Vinny,
you are doing some Rube-Goldberg array operations in your code, like using InsertIntoArray when you should use BuildArray:
Oh damn, please don't add me to the list 😅 I actually was confused when building the code a week ago as it was not working ... I actuilly forgot to right click and change the building mode to concatenate input.
@GerdW wrote:
Why do you need to shift the array data as you did? Simply use the "newest data" instead of shifting it inside the array and deleting "excess data"!
And then you don't "add" (aka "append") new data, but you did "insert" data at the end - just Rube-Goldberg!
I actually was wondering the same when I wrote my previous message and already tried it over before you replied. And it works fine 🙂
I think it's because it came from my initial idea of first initialising an array of X elements and then always working with this one, and I haven't removed it.
Works fine that way now, just sharing the 2019 version just in case someone would like to use it 🙂
@GerdW wrote:
You do subtract start time from current time in the FOR loop. This difference is used for X axis values…
This I still don't get it though... I'm substracting Current Time (Last value of the FOR loop) to the "Current Time" saved in the array at index 0.
Not sure if there is a misunderstanding, but I'm talking about the substraction done on the right side of this image. Not the one that I'm doing in the FOR loop which is just giving me a relative time as an input for the graph.
Thanks again for your help.
Solution on LV 2019:
08-25-2020 04:09 AM - edited 08-25-2020 04:10 AM
Hi Vinny,
@VinnyAstro wrote:
This I still don't get it though... I'm substracting Current Time (Last value of the FOR loop) to the "Current Time" saved in the array at index 0.
Not sure if there is a misunderstanding, but I'm talking about the substraction done on the right side of this image. Not the one that I'm doing in the FOR loop which is just giving me a relative time as an input for the graph.
This difference is ok for me.
I just ran the VI and the "Time displayed" stays at ~4.03s when I set a "Time T to display" of "4"…
08-25-2020 04:44 AM
@GerdW wrote:
Hi Vinny,
...
I just ran the VI and the "Time displayed" stays at ~4.03s when I set a "Time T to display" of "4"…
Yes, even if you put 10, you have a tiny bit more than 10 s displayed.
While it is, according to me, not a big issue (This is just a way for the user to manage how much data to be displayed on the graph, no need to be extra accurate here), I believe it comes from the fact that I am building the array after checking the sizer of the array and I'm displaying it also right after.
So the array displayed (and time difference calculated) actually has a size of "Max Size" + Number of samples collected in the FOR loop.
Not a big deal IMO as the number of samples collected in the FOR loop will always be negligeable toward the "Max Size" of the array.
08-25-2020 04:46 AM
Also, something to keep in mind is the "Round to +Inf" that is giving the loop count.
Too few Samples per seconds over the refresh rate will not give a nice result.
But that is not something the user will really have access to (boundaries will be set)
08-26-2020 08:58 AM
"Subtract" NOT "Substract"
Substract
08-26-2020 09:17 AM
@RavensFan wrote:
"Subtract" NOT "Substract"
Sub
stract
Yes hahaha sorry I know but I'm constanly knowingly making this mistake (even when doing a Quick Drop in LV...) It's kinda OCD at this point.
I believe it's because in french Subtract is "Soustraire" and you pronounce the second S ... Or it comes from researching too much subs (subtitles) online 🙄