LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fixed number of points into an XY graph

Solved!
Go to solution
Solution
Accepted by topic author VinnyAstro

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.

 

VinnyLaTaupe_0-1598345782911.png

 

Thanks again for your help.

 

 

Solution on LV 2019:

XY Graph sweeping.png

 

0 Kudos
Message 11 of 16
(775 Views)

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"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 16
(770 Views)

@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.

0 Kudos
Message 13 of 16
(761 Views)

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)

0 Kudos
Message 14 of 16
(759 Views)

"Subtract"  NOT "Substract"

 

Substract

0 Kudos
Message 15 of 16
(737 Views)

@RavensFan wrote:

"Subtract"  NOT "Substract"

 

Substract


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 🙄

0 Kudos
Message 16 of 16
(733 Views)