LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with lag in program

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

0 Kudos
Message 1 of 15
(3,011 Views)

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.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 15
(2,985 Views)

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.

0 Kudos
Message 3 of 15
(2,978 Views)

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 spaceSmiley Surprised

 

And, you kind of get odd behaviour with that "switch while pressed" stop button and the local reads don't you? Smiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 15
(2,967 Views)

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

 

0 Kudos
Message 5 of 15
(2,954 Views)

aa.png


"Should be" isn't "Is" -Jay
Message 6 of 15
(2,947 Views)

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

 

0 Kudos
Message 7 of 15
(2,936 Views)

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

aa.png


"Should be" isn't "Is" -Jay
Message 8 of 15
(2,925 Views)

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

Message 9 of 15
(2,904 Views)

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.

 

  • you have almost no code in case 0 its just there to init FP values you may be better served to remove the stacked sequence and replace all code in case0 with a invoke node and run the method "Default Values:Reintialize All To Default" (Select Class. VI Server>VI>VI)  if you leave the referance input unwired the invoke node assumes "This VI" and should operate as desired.
  • Implementing the above- the event loop is allways ready to service events- If you do not chose to remove the sequence structure consider moving the event loop outside the sequence structure.
  • There is no reason to enqueue default data (might even be bad) push the enqueue inside the case with the DAQ assistant

 

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


"Should be" isn't "Is" -Jay
Message 10 of 15
(2,897 Views)