LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

any way to get 2 readings from while structure??.

The problem you're having is because with each iteration of the loop, you are creating a brand new plot and not appending data to an existing one. If you were to open context help and move your mouse button over the XY Graph indicator, you would see that building an array of clusters is the definition of a multi-plot. What you should do instead is have a shift register for the x array and a shift register for the y array. With each iteration, you would use the build array to add the new elements to each array. Then after the build array, a bundle function would create the single plot for the graph. You'll have to be careful though. I have no idea how long you would intend to run this and how big the array is with each iteration. You might soon run out of memory.
Message 11 of 25
(1,454 Views)
Hi Dennis,
 
Thanks for your entry!.
I see, then it is not very useful , if i will have problems with the memory.
Can you tell me any way to get my application?.
You can see the last file attached, with serial example. I would like draw in real time the curve as the same time I am getting the acquisition.
I am testing read from serial 2 readings and use it, since i need 2 points to get one sample. But i have the problem to get it properly.
I would like you advise me the best way and if it is possible easy :). Different possibilities to get it, since my nivel program is low yet.
 
Thanks for all your help, always very grateful with you!.
 
0 Kudos
Message 12 of 25
(1,443 Views)
For one, I don't see any reason to use a queue. You should be able to immediately graph the data after is has been read from the serial instrument and you do your conversion. What I'm a bit confused about is what data you want graphed and how it should be represented. For example, you have a couple of formula nodes. Each produce a scalar. You then do a build array with another value from the serial read. Which point is the x axis, y axis or do these represent separate plots or something else.
Message 13 of 25
(1,436 Views)

Well, keep in mind this is a simplified vi, you can see capture.gif in previous post to see the real vi. Really it changes very little.

I use the consumer queues to show the rpm. I add the number of rollover from 16bits counter to fit the real period of each pulse. Then i can play with the 3 inputs. 1- rpm wheel. 2-rpm engine. 3- sensor Tª reading.

I used the queue to do this little calculates with formula nodes and see the engine and wheel rpm with 2 differents dials. Really no more is inside of consumer loop. Also I use when the acquisition is finished, then all the data is sent to main vi to fit the data to draw perfect curves. This vi is one subvi, which only read the serial port and show several dials, all the data is sent in array. When i close this screen all the data is sent to main vi.

Then,

1)Do you think i should remove the queue and put all inside of while lopp of serial port??.

2)I want show in little graph the curve, for that i need First sensor reading and Second sensor reading, I input this parameters in little subvi, which  only takes different formula nodes, and this subvi give the data to show in little graph. Since I need 2 readings to get 1 sample, I need read 16 bytes instead of 8 bytes. Althought I would prefer only read 8 bytes and later get the old value and new value to get the same. BUt i didnt get it!. I want show in this graph one curve from the data from sensors. But i want add 1 point in each iteration to look at real time or almost real time.

I would be very grateful if you give me a little light.

Regards,Jose.

 

Mensaje editado por Fonsi

0 Kudos
Message 14 of 25
(1,431 Views)
But I still don't understand what you want graphed. You mention sensor 1 and sensor two. I have no idea which wires on you diagram these represent and what kind of curve you want. Is sensor 1 a single point on the x-axis and is sensor 2 and single point on the y axis or do you want to have two separate plots where plot 1 is sensor 1 and plot 2 is sensor 2. Explain this and maybe even add some comments to your VI or to the gif image.
Message 15 of 25
(1,422 Views)

Hi Dennis,

Just i went to put new post and i see your post :). Thanks for your help.

Well, I have attached the real vi capture. I have modified the vi, like you told me. I have removed the queue. I have checked it with wave generator and it looks works well. And the array is updated when finish all. It seem works well.

Well, I want  use the sensor 1 and sensor 2 in one graph XY. Really I get the sensor 1 = period and i got power (hp), it is y-axis graph, and sensor 2 is rpm, so it is x-axis graph. Really from this figures I only with formulates nodes get the power, to get it I need 2 points to get power, and 2 rpm readings to get the average rpm. Therefore for get the idea, simply you can imagine I can draw in XY graph the sensor 1 like y-axis and sensor 2 like x-axis directly. Maybe now is interesting use queue.

THe sensor1 = S1 and sensor2 = S2. I need use later of formula node x+65536*a

I hope you understand me now.

 

0 Kudos
Message 16 of 25
(1,417 Views)
Okay, so what you really want is an XY Graph that acts like a chart so you can update it in real time - one pair at a time. Well, you can do this. There is a shipping example called XY Chart that shows you how this can be done. With this, you don't have to mess around with creating arrays and using a shift register in a separate while loop or use a queue (unless you really want to). In the example, you'll want to look at the chart where a single point is being updated.
Message 17 of 25
(1,413 Views)
Dennis,
 
I didnt get it.
I try to add the chart xy graph. But it doesnt run.
And you forget I need 2 reading from sensors to get  1 point x-axis and y-axis. Therefore I would need the new readings from sensor and the old readings previous to get one value to draw in graph, do you understand?. I believe to get it I need shift register or any similar, dont believe?.
If you can show me it on gif or vi, please.
 
0 Kudos
Message 18 of 25
(1,409 Views)
I thought you were getting two readings from the VISA Read you had now? Do you mean that with one iteration you get one reading and and with the next iteration of the loop you get another reading? If that's the case, frankly I don't understand why you would do that. Why can't you simply have two VISA Reads in a single iteration?
Message 19 of 25
(1,405 Views)

Yes Dennis,

I thought you are speaking to fit in this way.

Ok, then i will put read 16 bytes... later are 6 readings. 2 each sensor. I put like in capture, and it works, i forgot put x and y autoscale :).

Ok, thanks for all Dennis. I learm a lot with you. Here in Spain are 0:20, so I will test tomorrow with 2 readings from serial port and charts XY.

Thank you very much!.

Regards, Fonsi.

0 Kudos
Message 20 of 25
(1,402 Views)