01-30-2012 09:36 AM
This is my first time posting and I am new to LabVIEW. I took the NI Basic and Intermediate courses and now I am the "expert" at work. When I run my program, the plots are fine but when I start writing to a file there is a lot of lag on the plots. I do not know what the 'actual' problem is and what I should do to fix it.
I created a program to read 12 Analog Voltage inputs and plot them and also write to file.
I am using LabVIEW 11, 32-bit on Windows XP
DAQ Hardware: 0-10Volt signals from pressure transducers -> NI 9205 -> NIcDAQ-9174
Thanks,
Chris
01-30-2012 10:44 AM
Did you write this after taking the courses? You should put the logging in a separate loop from you data acquisition using a producer consumer type architecture.
01-30-2012 10:50 AM
I started writing the program before I took any courses. This is only a program that will be used for a week and then discarded so I did not worry about making it "deliverable". I am just trying to get it to work. I could rewrite it to a producer / consumer architecture but I do not know them well and I was hoping for more of a patchwork answer. If there are none then I will begin figuring out the producer/consumer structures.
01-30-2012 11:50 AM - edited 01-30-2012 11:54 AM
Well, Thats some unusual code there Chris!
Prompts inside a data acquisition loop will allways look like lag since the acquisition is not stopped while the prompt is up you just stop reading them out of the devices buffer. When the prompt is down you statr reading the first sample in the buffer that was taken about the same time the prompt was raised.
Lets take a peek at the worst misconception though- why 12 wait for front panel activities? ANY front panel activity will cause ALL of the waits that have a True value to fire at the same time! effectively you wrote "If any plots are being displayed to the user don't update Test Array A until the User interacts with the front panel" I doubt this is what you intended.
I don't suppose you looked at the Min & Max primitive on the comparision palatte either- It would save you about 12 case structures and about a screen of BD space
And, you kind of get odd behaviour with that "switch while pressed" stop button and the local reads don't you?
01-30-2012 01:01 PM
Okay,
As you can tell I have no experience with LabVIEW. I tried breaking this into parts from the reponse I got.
1) I changed the mechanical action of the stop button. Thank you for pointing it out.
2) I did look at the max min primitive along with the Express Statistics VI. The problem I have using them is they give me the max and min value for that sample which changes every sample.
3) The plot property nodes were set up so that when the user clicks the boolean control, the plot will appear or dissapear from the graph. I was trying to make it so the only time it will run the loop is when one of the controls was pressed.
4) Most importantly, Saving the data should be a seperate loop from prompts. This makes sense and I am changing this now.
Thanks,
~Chris
01-30-2012 01:31 PM
01-30-2012 02:10 PM
Thanks Jeff. That helped clean up part of the code. I still need some assistance with handling my plot property nodes. I took out the 'wait for front panel activity' functions but I would still like to only check the boolean buttons when one of them change state.
Thanks,
~Chris
01-30-2012 03:01 PM
Well. An event structure might help. Here is a start of an event loop to replace that odd structure.
Add another event Case to handle the T plots. and edit the stop case to work in your environment. The help file has some good reading on events.
The example is broken only because I did not create a chart so that property node is invalid
01-31-2012 09:45 AM
I decided to redo the VI with the suggestions you made but I have not added the max/min data yet. I used a producer/consumer approach to aquire data, plot to a chart, and save to a file. I also implemented the event structure you suggested. I have a few questions for making this all work:
1) How can i seperate the data and send to 4 different wave charts?
2) How can i initialize all of the boolean references to false? I made the boolean buttons default to false but that does not trigger the event structure.
I attached the new VI for reference.
Thanks again,
~Chris
01-31-2012 11:00 AM - edited 01-31-2012 11:04 AM
Vastly superior! Here's your first Kudos for the effort!
Let my make a couple suggestions and then I'll try to answer your questions.
2) Writing to a terminal, local or value property node does not cause a value change event. VCEs are only generated by user interaction that changes a value or writing to a value(signaling) property node NOTE: Value(Signaling) Allways fires the VC event even if you write the existing value (These points burn developers every day- we almost all have learned them the hard way)
1)This will have to be done by splitting and merging the signals into "channel groups" that can be built into an array