Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Unexpected Delay When Comparing Offline EMG Signal and Real-Time Acquisition with Simulink Desktop Real-Time Using NI PCIe Card

 

 

Description:

I am working on a system to simulate an EMG signal using an NI USB DAQ device with LabVIEW. LabVIEW reads EMG data from a CSV file and generates the analog signal at 500 Hz through the analog output. This analog signal is then acquired by an NI PCIe 6323 card connected to my PC via a PCIe-to-Thunderbolt chassis. Using Simulink Desktop Real-Time (SDRT) on this PCIe card, I process the signal in real-time and generate an analog trigger output to control a mechanical ventilator.

 

My goal is to estimate the delay introduced by the system by comparing the trigger generated by the SDRT real-time model with the trigger generated by the same model running offline in Simulink.

 

Issue:

When I start LabVIEW and then start Simulink SDRT a few seconds later, I observe that the EMG signal acquired in SDRT has the same waveform shape as the offline model, but the reference peaks (e.g., a timestamp marker at 288 seconds in the offline model) appear significantly later in the real-time acquired signal—between approximately 310 and 460 seconds.

 

This is counterintuitive because, since SDRT starts after LabVIEW, I would expect the real-time signal to be shorter (due to missing initial samples) and thus the marker to appear earlier (for example around 240 seconds), not later.

 

Additional observations:

 

  • I do not see zero or noise before the EMG signal starts in SDRT; the EMG waveform is already present immediately upon starting the real-time simulation.
  • The sampling frequency is correct, and the signal shape is not distorted or stretched/compressed in time, so clock mismatch or sampling rate errors do not seem to be the cause.
  • I suspect the PCIe card is acquiring data into a circular buffer, so when SDRT starts reading, it reads previously acquired data. However, this alone does not explain the anomalous delay of the marker.

 

 

Questions:

 

  • How can I interpret this forward shift in time of the marker peak in the SDRT-acquired signal compared to the offline model?

 

0 Kudos
Message 1 of 2
(88 Views)

A forward shift in the marker peak likely indicates a combination of system delays, processing effects, and physical propagation time differences. Careful calibration and understanding of the system's transfer function can help quantify and account for this shift.

CLA
0 Kudos
Message 2 of 2
(71 Views)