08-03-2025 03:33 PM - edited 08-03-2025 03:38 PM
I am working on plotting a real-time scatter plot based on peaks that occur when droplets are detected through sensors. I have a simulated VI using a built-in signal. I've implemented a state machine to detect different stages of the signal. The peak is determined using cursors defined on the signal graph plotted on the front panel. If a peak goes above the threshold set by the cursor, it is considered valid and analyzed to be plotted on the scatter plot.
Here's how my state machine works:
Peak Amplitude: If the data points go above the cursor threshold, values start being recorded and updated with the maximum value using feedback, until the data falls below the threshold again.
Peak Width: When the signal goes above the cursor Y-value, I start counting the data points and increment the counter for each data point. The total count is then divided by the sampling rate to get the peak width, which is plotted on the XY graph.
However, my VI is not working as expected.
Solved! Go to Solution.
08-03-2025 06:41 PM
It probably does not work as expected because the code does not make a lot of sense. You are generating five values per iteration, but you only keep one.
A default value of frequency=0 dos not seem reasonable. What value are you using?
You always record data on the xy graph, but sometimes you just repeat stale data.
If I understand this right, you just want to count the total duration where the signal is above a threshold.
08-03-2025 06:46 PM