It has been some weeks that I’m fighting with synchronization purpose in Labview and I appeal to the community to get some suggestions.
The problem is a problem of synchronization between 3 inputs/outputs:
-1 analogic output voltage obtained from an NI DAQ card PXIe-6368 (X series)
-1 analogic input voltage (same card)
-7 accelerometers plugged on an NI PXIe-4492 card
The sensors acquisition and code is working well except for synchronization purpose. My code is in attachment with 5 VI:
-Main.vi is the main file that after the initialization of the different input/output task (using the subVI SynchronizationGlobal.vi) read/write the sensor continuously (while loop).
-In SynchronizationGlobal.vi, the master and slave are defined.
-In SynchronizationClockTrigger.vi, the parameter for each clock and trigger are defined
- SECH.vi is used to generate a waveform wavelength and is defined in a while loop since this parameter can change during execution.
-Get Full Terminal Name.vi is directly taken from Labview examples (examples\DAQmx\Synchronization\Analog Input - Synchronization.vi)
I have currently two different problems:
-When I plug directly the output voltage to the input voltage, there are not in phase although they are plugged in the same card. The only way I found to synchronized then is to define the waveform and full the buffer of the “write” task before the “start” task but with this method, I cannot change the outpout waveform in the while loop.
-Problem of synchronization between both cards. I’m using the PXI clocks to synchronize them (PXIe_Clk100 for PXIe-6368 and PXI_Clk10 for PXIe-4492) but still it is not working. The shift in delay is something like 0.01s and I don’t think that this delay is due to components between the analog output and the accelerometers (amplifier + shaker).
If anyone has some ideas on how to fix these synchronization purposes, they are welcome.
I once observed a similar issue: I used a cDAQ system with an analog input and an analog outout device, which I connected together. The measured value was always half a period off, independant of the period duration. This is plausible (at least to me), because you can't provide the signal and aquire it at the same time with the same system. To avoid this issue I added a trigger delay of a half period to the AI channel. Hence the signals match. But I don't think this is necessary in normal operation.
I hope I could help.
Thank you for your answer. Unfortunately I tried your method but when I add the delay, the delay between output and input curves increases.
I also notice something strange to me. At the first iteration in the “for loop” over time, the delay is 0.02s then becomes 0.03s after the second iteration and remains constant (see image). If this can help to understand things….