03-31-2022 06:53 PM
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.
04-01-2022 01:14 AM
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.
04-01-2022 12:28 PM
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.
04-02-2022 08:21 AM - edited 04-02-2022 08:34 AM
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…
04-02-2022 10:43 AM - edited 04-02-2022 10:43 AM
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.
04-02-2022 11:40 AM
@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.
04-02-2022 12:21 PM
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.
04-02-2022 04:25 PM
@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.
04-02-2022 07:30 PM
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.
04-03-2022 08:59 AM