Tuesday, June 4, 2024

Can messages be used like this?

I'm trying to do two things:
1) send a known waveform at a fixed interval
2) record the input to file for a fixed duration after each transmission
3) test this system, without hardware, by connecting the transmission stream to the reception stream

Basically, it's a radar/sonar kind of thing.  I'm sending a transmission, and then listening to what reflects back.  

Parts 1 and 2 seem fine.  For 1 I was able to copy the PDU_Lambda demo, which works great.  For 2 I decided to use the transmission message as a trigger to an embedded python block.  I have that block start buffering data once it receives a message.  After it has received a fixed amount of data it records it to a file and publishes the data as a message which I can use to plot data.  As a result I expect that t=0 in the Time Sink is roughly lined up with when the transmission started (within the margin of error for messages, which I've noticed is about 100us).

Part 3 is where things are broken.  For testing I want to just generate some background noise and use a delayed copy of the input.  So I wrote another embedded python block which just copies data from the input stream to the output stream, but if it receives a message it will add the contents of that message to the output stream.  I then delay that stream by some amount of time.  As a result I expect to see a delayed and noisy copy of the transmitted signal in both my message plots and my recorded file.  I don't expect this to be perfect, and it doesnt need to be, but I'd expect it to be within a few milliseconds.  The problem I'm having is that even though the message is delivered to both the recording block, and the test block, within <1ms of each other I'm noticing that the recorded file (and the plots) always show the signal with no delay.  In addition to a noise source + a throttle, I've also tried using my sound card as the source as a test but I get the same result.

Here is the flow graph.  And below that is the time series plot when I use my soundcard for the source and the receiver in ADDITION to mixing in the transmit message digitally.  I would have expected this signal to be delayed 0.5 seconds (aprox).  It doesnt matter what I set the delay to, the plot always looks the same.




Thanks,
Jay

No comments:

Post a Comment