09-17-2020 05:06 PM
I'm making a VI to calculate lung tidal volume, which is the integral of the difference between two flow sensors over time. I expected to find a function that would integrate some real-time signal coming in one data point at a time (using some internal state to remember the value it had) but so far haven't found anything like that. I wrote the below VI to do this manually using shift registers and a simple trapezoidal integration of the new signal based on the known rate of the loop.
This solution seems to work but I feel it's maybe over complicated, and it seems like there probably exists a pre-made function that uses the system time and an internal state to do this all without so many moving parts,and probably more accurately. I haven't been able to find anything so far by searching for it, but I am pretty new to Labview and might just be misreading or misusing some function.
Any help finding a better function, or any ideas on potential problems with this solution, would be appreciated.
Solved! Go to Solution.
09-18-2020 01:02 AM
Hi Tarnarmour,
@Tarnarmour wrote:
I wrote the below VI to do this manually using shift registers and a simple trapezoidal integration of the new signal based on the known rate of the loop.
This solution seems to work but I feel it's maybe over complicated,
To me this VI looks like being simplified too much because it's empty…
Mind to attach your real VI?
09-18-2020 04:09 AM
@Tarnarmour wrote:
I'm making a VI to calculate lung tidal volume, which is the integral of the difference between two flow sensors over time. I expected to find a function that would integrate some real-time signal coming in one data point at a time (using some internal state to remember the value it had) but so far haven't found anything like that. I wrote the below VI to do this manually using shift registers and a simple trapezoidal integration of the new signal based on the known rate of the loop.
NI_PtbyPt.lvlib:Integral x(t) PtByPt.vi
From the code inside, I think it might use trapezoidal integration.
09-18-2020 01:42 PM
Well I'm not sure how that happened, I'll be trying to check this one more carefully after I post.
09-19-2020 08:23 AM
I can't open your VI because I haven't (yet) installed LabVIEW 2020. But note Wiebe's reply -- the Point-by-Point functions can be found on the Signal Processing Palette.
Bob Schor
09-22-2020 11:29 AM
Thanks! I've been looking at it and I think it'll massively clean up a pretty horribly messy VI 🙂