LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data acquisition

I have this VI that performs some Data acquisition to get some numbers. Now everything in this VI works like how i want it to, except for the DC/AC and DC  2/ AC 2 and the R indicators in the VI, once the program runs, those values are acquired once then dont change. How can i make it so that these values are constantly being acquired and calculated while the Vi is running. ( like the XX indicator, the data for this indicator is constantly being read and the XX value keeps on changing).

Note: the Daq assistant connected to the waveform and the amplitude level measurements function receive a voltage input.

0 Kudos
Message 1 of 15
(1,798 Views)

Hello,

 

You have race conditions issues so your software doesn't know if it has first to update the indicator or read the local variable (DC 2, AC 2, DC 2/AC 2...).

I suggest you make a small state machine instead of your stacked sequence to organize what you are doing and get ride of those race conditions by doing so.

 

That is the first step to have something more robust. Second step will be to replace DAQ express by DAQ acquisition.

 

 

0 Kudos
Message 2 of 15
(1,765 Views)

what exactly do you mean by race conditions issue. From what I understood, i needed something to let the program know what to do first, so I tried putting the read local variables in a separate frame in the flat sequence, but it still doesnt work, I did that because I dont really know how state machines work. 

Im just trying to make it like the XX indicator, why does the value of that keep changing but not for the DC/AC and R indicators.

 

So what can I do to fix it.

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

Hi dannn,

 


@dannn2020 wrote:

what exactly do you mean by race conditions issue. From what I understood, i needed something to let the program know what to do first, so I tried putting the read local variables in a separate frame in the flat sequence, but it still doesnt work


Why do you need all those local variables at all? Why not use wires instead - you should always obey "THINK DATAFLOW!"

 

See this:

That's just replacing your locals by wires. It's not meant to show "good" programming rules!)

 

What's the point in placing a 101ms wait in the loop when the frames of your sequence already wait 101ms in total?

Why do you need so many ExpressVIs? Do you understand how to handle DDT wires correctly?

Why do you need to determine an array size twice on the very same array?

 


@dannn2020 wrote:

I dont really know how state machines work. 


Did you open the example projects coming with LabVIEW? They already explain state machines!

Learn from the examples provided by LabVIEW…

 


@dannn2020 wrote:

it still doesnt work,

So what can I do to fix it.


Did you try to handle all errors in your VI? There's no error handling at all right now!

To "fix" your VI I recommend to reduce the number of ExpressVIs as much as possible…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 15
(1,693 Views)

The thing is that i need to get DC 2 and AC 2 in the 3rd frame, also if they are using the same waveform before it changes DC/AC DC 2/AC 2 will be exactly the same. So I tried removing the local variables and wired the R to the outside of the sequence but it still only reads them once then stops changing, why is that.

Also why does the XX calculation constantly change but the R and S dont.

0 Kudos
Message 5 of 15
(1,678 Views)

@dannn2020 wrote:

 

Also why does the XX calculation constantly change but the R and S dont.


Because the peak locations at the end of the waveform change but the peak values don't.


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 15
(1,668 Views)

But how don't the peak values change, when I run the program and observe the waveform, each peak is slightly different.

So how can I make it so that the negative peak and peak to peak value is being read in each iteration of the loop.

0 Kudos
Message 7 of 15
(1,663 Views)

@dannn2020 wrote:

But how don't the peak values change, when I run the program and observe the waveform, each peak is slightly different.

So how can I make it so that the negative peak and peak to peak value is being read in each iteration of the loop.


They already are being calculated on each iteration for every peak!

 

You are simply ignoring the peak values out of the peak detector vi and recalculating signal minimum and maximum on the appended waveform.  Those will only change when something bigger comes along than has already been seen.


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 15
(1,652 Views)

But some peaks are bigger than others, as in I could get a small peak then a bigger one then a bigger one then a smaller one and so one, its not a constant peak with the same amplitude. S im really sorry but I don't really understand what you mean. So can someone please help me so that I get the new peak to peak and negative number for each new peak.

0 Kudos
Message 9 of 15
(1,645 Views)
Wire the outputs of Peak Detector.vi to indicators and stick probes on them then add a breakpoint after each iteration. You'll see what you have done wrong. ✔

"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 15
(1,631 Views)