02-02-2023 03:32 PM
I am acquiring multiple channels of analog data continuously and processing it in blocks as it becomes available. I need to apply a slightly different time delay on each channel to correct for physical misalignment of the sensors. The delays required are not integer multiples of the sample rate. The Resample (constant to constant, multi-channel) VI from the Signal Operation Palette would work, except it applies the same delay to every channel. The Resample (constant to constant, single channel) VI would allow a different delay for each channel, but it stores internal state data that precludes its use for multiple channels in continuous acquisition mode. The number of channels is not necessarily known at compile time. Is it possible to instantiate a different instance of the Resample (constant to constant, single channel) VI for each channel at run time, or is there another way to achieve the same goal? This project is using LV2018.
Thanks in advance for your ideas!
John
02-03-2023 01:13 AM
Hi John,
@JohnZ wrote:
I need to apply a slightly different time delay on each channel to correct for physical misalignment of the sensors. The delays required are not integer multiples of the sample rate.
Read your channels as waveforms, then you can adjust t0 very easily!
@JohnZ wrote:
The Resample (constant to constant, single channel) VI would allow a different delay for each channel, but it stores internal state data that precludes its use for multiple channels in continuous acquisition mode.
There's a "reset" input for this function…
02-03-2023 01:55 AM
From what you wrote it seems you really want to resample the data. I am not sure how exactly Resample works and why it keeps any inner state. When I have VI for single channel that's not pure (has inner state with shift registers), my practice is that I copy the VI, bundle and unbundle the SRs to a single SR, and wire it out of the VI. This way I can control the inner state access myself, I can make the unitialized shift register one VI higher in hierarchy. I even have the Resample VI converted this way in my personal library!
But you don't talk about purpose of your code and I have feeling that you might be a little wrong with it. I am asking why would someone want "slightly different time delay"?
02-03-2023 06:53 PM
Hi GerdW,
@JohnZ wrote:
I need to apply a slightly different time delay on each channel to correct for physical misalignment of the sensors. The delays required are not integer multiples of the sample rate.
Read your channels as waveforms, then you can adjust t0 very easily!
Perhaps some context for the application will help. Consider a linear array of sensors crossing a linear feature in a test object. If the sensor array is perfectly aligned with the test feature, each sensor channel will generate a signal that is perfectly in phase with all the other channels as it passes over the feature. However, if the sensor array is angled slightly relative to the test object, then each channel will generate a signal that is slightly out of phase with the other channels. The reason I was trying to use the Resample VI is that it actually recalculates the Y-values for a channel as if it had been sampled at a slightly different time to compensate for the physical misalignment of the sensor array. Eliminating that slight skew between channels would simplify subsequent processing steps. Is there a way to do that with the waveform functions?
@JohnZ wrote:
The Resample (constant to constant, single channel) VI would allow a different delay for each channel, but it stores internal state data that precludes its use for multiple channels in continuous acquisition mode.
There's a "reset" input for this function…
The "reset" input for the Resample VI clears the internal state information of a Call Library Function Node. That node uses an FIR filter for interpolation smoothing and does not return the full number of data points supplied on the first call after reset, since the FIR filter output has to lag behind the input. Using the reset between channels would be fine in a single shot application, but in continuous mode you lose a portion of the data on each call. I tried padding the input signal with zeros to account for the unreturned data points, but I still get a discontinuity between consecutive blocks.
Maybe I'm missing something in one or both of your suggestions?
Thanks,
John
02-03-2023 07:16 PM
Hi VitSlaby,
Your sample VI appears to be in LV2021. This project is using LV2018. Can you resave it for the earlier version?
As for the reason I want a slightly different time delay on each channel, see my response to GerdW above.
Thanks,
John