From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
08-19-2020 10:41 AM
Hi!
I'm communicating remotely to a platform (via wifi) to receive its inclication delivered by an on-board inclinometer.
I cannot fully manage interval between 2 samples for various reasons that I can't change.
I was then thinking of using a timestamp at the moment I'm requested the info and then to plot the results in an XYgraph.
Problem is that I want mygraph to be sweeping smoothly like with a chart, the the XYgraph is displaying "one full array" at a time.
The solution I came with is the following
It work fine, I have almost the result I want except that it is a bit epileptic ... The graph doesn't move point by point but section by section, making it difficult to read in real time...
The points are being updated smoothly, but the first point to appear on the graph doesn't "stick" to the side of the graph, so the curve moves forward, suddenly slides to the left leaveag the right side empty, and then fill in the right side again.
Do you have any idea how I can solve that ?
PS: Instead of using the array solution where I mage its lenght by myself, I tried using a lossy engueue element, but then the question came on "how to put that element in an array ..." so in the end the problem was the same.
Thanks in advance for your help.
Vinny.
Solved! Go to Solution.
08-19-2020 01:49 PM
You'll probably want to stop using the Auto Scale functionality of the graph. If you right-click it on the front panel and look through the menus, there should be a checked entry for Auto Scale X to turn off.
Then, right-click the graph, and create a property node. You'll find a section for X scale range min and max. Set those to the min and max you want actually visible at any given time.
08-19-2020 01:57 PM
Auto scale should be fine.
But you will want to go to the Y-scale properties in the right-click menu and uncheck "Loose Fit".
One thing that concerns me is you are trying to update the graph in a loop with a 1 msec wait. That means LabVIEW is trying for 1000 updates per second. You can't even see that. I would try updating about 20 samples at a time before sending to the graph would would make it a palatable 50 Hz update rate.
08-20-2020 02:30 AM
@Kyle97330 wrote:
You'll probably want to stop using the Auto Scale functionality of the graph. If you right-click it on the front panel and look through the menus, there should be a checked entry for Auto Scale X to turn off.
Then, right-click the graph, and create a property node. You'll find a section for X scale range min and max. Set those to the min and max you want actually visible at any given time.
Hmmm if I uncheck that, my curve goes away given that my X axis is the absolute time.
08-20-2020 02:40 AM
@RavensFan wrote:
Auto scale should be fine.
But you will want to go to the Y-scale properties in the right-click menu and uncheck "Loose Fit".
One thing that concerns me is you are trying to update the graph in a loop with a 1 msec wait. That means LabVIEW is trying for 1000 updates per second. You can't even see that. I would try updating about 20 samples at a time before sending to the graph would would make it a palatable 50 Hz update rate.
What does "Loose Fit" do ?
So for the 1ms I was just playing around, actually as the sine function gets the iteration as input, it changes my frequency.
If I understand what you mean:
--> Get 20 samples
--> add them to the array in a lossy way (if the array has a size of 1000 and already has 990 samples in it, it will loose 10 samples "below")
--> display the array
Is that it?
08-20-2020 09:19 AM
Loose Fit off means your X-scale and Y-scale are set so the max and min range are set to your max and min values.
With Loose Fit on, it takes your Max and Min values, but rounds them to something a little nicer. That can help prevent from having constantly jumping scales, and also give you a nice round number for the origin.
But if you have loose fit on for an x-scale you want to continuously scroll, what happens is the x-scale minimum won't change on every point as data gets discarded, but whenever LabVIEW decides that the minimum x value should round to a new number.
So for the 1ms I was just playing around, actually as the sine function gets the iteration as input, it changes my frequency.
If I understand what you mean:
--> Get 20 samples
--> add them to the array in a lossy way (if the array has a size of 1000 and already has 990 samples in it, it will lose 10 samples "below")
--> display the array
Is that it?
Correct. And next time around your array will have 1000, you will add 20 and discard the oldest 20.
With loose fit turned off, and the graph updating 50 times per second rather than 1000 times per second, it should look like a smooth scroll and won't be killing the user interface thread doing graphic updates that really can't be seen by the user.
08-25-2020 02:47 AM
Hi!
After a few days off, I'm back on this 🙂
Thanks to your advice I've figured out something that working smoothly, big thanks for that.
However, I'm still having troubles on something weird, I attach a snippet below for reference:
Basically I want to display a 10seconds graph. At first I thought it was working well, the graph is building itself and being displayed nicely. But after a few seconds when I hit the "Time to display" I want (e.g. 10 seconds), while the array size doesn't change, the time displayed keep growing... for some reasons the values seem to not be deleted as fast as they get in the array ...
Do you have any idea that could explain this ?
Thanks,
Vinny.
08-25-2020 02:57 AM
Hi Vinny,
@VinnyAstro wrote:
Basically I want to display a 10seconds graph. At first I thought it was working well, the graph is building itself and being displayed nicely. But after a few seconds when I hit the "Time to display" I want (e.g. 10 seconds), while the array size doesn't change, the time displayed keep growing...
Surely the "time displayed" keeps growing: you calculate that value by subtracting start time from current time. And that difference is used as X axis value of your XY graph!
What else do you expect?
08-25-2020 03:12 AM
@GerdW wrote:
Hi Vinny,
Surely the "time displayed" keeps growing: you calculate that value by subtracting start time from current time. And that difference is used as X axis value of your XY graph!
What else do you expect?
I don't think that's what I do actually 🤔
The variable "Time Displayed" is obtained by substracting the very last value of "Relative time" in the For loop with the first value in the built array over time. The latter is supposed to be deleted and replaced by the upper values in the table over time due to the True Case Structure (being true when the array is full)
This case does the following:
-Take the oversized array (in my example 1000 is the limit, and it just received 20points from previous measurement, so current size is 1020)
Oldest value is index 0, newest is 1019
-Extract subarray from index "current-max size" = 19
-Place this sub-array in the previous array at position 0
-Delete the excess at the end of the array.
Then add the new values and display it.
So I'm not substracting Current time from start time, but current time from index 0 Value in my table.
Also in the screen shot of my front panel you can see that the first value in the X axis is 12,1516 which is not start time.
08-25-2020 03:28 AM - edited 08-25-2020 03:33 AM
Hi Vinny,
you are doing some Rube-Goldberg array operations in your code, like using InsertIntoArray when you should use BuildArray:
@VinnyAstro wrote:
This case does the following:
-Take the oversized array (in my example 1000 is the limit, and it just received 20points from previous measurement, so current size is 1020)
Oldest value is index 0, newest is 1019
-Extract subarray from index "current-max size" = 19
-Place this sub-array in the previous array at position 0
-Delete the excess at the end of the array.
Then add the new values and display it.
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!
@VinnyAstro wrote:
So I'm not substracting Current time from start time, but current time from index 0 Value in my table.Also in the screen shot of my front panel you can see that the first value in the X axis is 12,1516 which is not start time.
You do subtract start time from current time in the FOR loop. This difference is used for X axis values…