LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY-Plot has weird output of unspecified data

Solved!
Go to solution

Hello,
i'm just testing my VI atm and wanted to save some datapoints in shiftregisters to plot them in a xy-graph.
It plots datapoints i never calculate, is anyone able to figure out why?
Screenshot and VI are attached.

2020-05-05_18h59_14.png

Best Regards,
MT_at_home
0 Kudos
Message 1 of 16
(3,128 Views)

I recommend a few tutorials. None of your local variables are needed. You have several loops running unsynchronized and external code that only gets calculated once. Whenever you read a local variable, you get the last written value. Most get written from several places in parallel.

 

Your overuse of local variables probably comes from a text programming background. In LabVIEW, the wire is the variable. In your case, you also blur the distinction between controls and indicators (e.g. the dial)

 

Why is your shift register initialized with an array containing data (0,1,2,3,4,5,7)? Empty it!

 

Learn about dataflow. What's the purpose of the second loop? What are you actually trying to do?

0 Kudos
Message 2 of 16
(3,095 Views)

@altenbach wrote:
...

Learn about dataflow. What's the purpose of the second loop? What are you actually trying to do?


I'm trying to achieve the following:
Replicating a measurment where the parameter Schichtdicke[mm] is changed every Zykluszeit[s] seconds.
Parallel to that i want to plot the momentary measured value in the graphs every 0.01s.

Best Regards,
MT_at_home
0 Kudos
Message 3 of 16
(3,032 Views)

Hi MT,

 

to achieve your requirement you should follow Christians suggestions.

Start with replacing ALL local variables by wires…

 

(Falls du mit deutschsprachiger Hilfe besser zurechtkommst, kannst du ja im www.labviewforum.de nachfragen…)

Best regards,
GerdW


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

I cleaned up the VI and removed the parallel loop for now.
But i still didn't figure out why my plot throws out the unwanted values at the beginning and i thought i'm already initializing the shift register by putting the value outside the loop to its left.
The local variables were used so the parallel loops didn't block each other.
Now they are still there but for not having a mess of wires.

I'm usually fine with english, but thx for mentioning the german forum.

Best Regards,
MT_at_home
0 Kudos
Message 5 of 16
(3,020 Views)

I tried it with initializing the array but now i get double plots of my values...

2020-05-20_21h42_59.png

2020-05-20_21h43_16.png

Best Regards,
MT_at_home
0 Kudos
Message 6 of 16
(3,007 Views)

According to this post:
https://forums.ni.com/t5/LabVIEW/How-do-I-make-an-XY-Graph-plot-points-over-time/m-p/610206/highligh...
I shouldn't even have to initialize the array in my loop.
Starting with the initialization outside the loop like in my first try should be enough but in my case it gave me the unwanted datapoints.

Best Regards,
MT_at_home
0 Kudos
Message 7 of 16
(2,998 Views)

I don't think you've ever clearly stated which data points you are talking about that are unwanted.

0 Kudos
Message 8 of 16
(2,963 Views)

@MT_at_home wrote:

I cleaned up the VI and removed the parallel loop for now.
But i still didn't figure out why my plot throws out the unwanted values at the beginning and i thought i'm already initializing the shift register by putting the value outside the loop to its left.
The local variables were used so the parallel loops didn't block each other.
Now they are still there but for not having a mess of wires.

I'm usually fine with english, but thx for mentioning the german forum.


Please do take the advice already given and GET RID OF THE LOCAL VARIABLES. Your code will look MUCH better when you have nice, clean wires showing dataflow instead of the mess of wires and local variables that you have now, and it will save you a lot of headaches. It is virtually impossible to tell what you're trying to do. Also, clean up that Rube-Goldberg code. There are a lot of places that you can use the Compound Arithmetic node, for instance. 

 

0 Kudos
Message 9 of 16
(2,953 Views)

@MT_at_home wrote:

I tried it with initializing the array but now i get double plots of my values...

2020-05-20_21h42_59.png

2020-05-20_21h43_16.png


 

And if you run that code again without having closed down your program you will have three plots of your values. This is not an initialized shift register. The link that you showed of the post from the late great Dennis Knutson showed a shift registers initialized with an empty array. This is the proper way. 

0 Kudos
Message 10 of 16
(2,951 Views)