From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Discussions au sujet de NI LabVIEW

annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

Control Loop : Minimal Latency

 Hello everyone !

 

I develop a control application for ultrasonic piezoelectric transducers. I would like to implement a phase lock loop, thus I need to measure the phase difference between two signals and then generate one.

 

1. Acquisition of two sinusoidal signals with the same frequency (between 10 to 60 kHz), 2. phase detection, 3. regulation, 4. generation of the output signal with frequency in the same range. I would like that one cycle of control 1-4 takes less than 10 ms in the best case and less than 30 ms in the worst case.

 

I am working with a NI USB-6251 (currently on PCIe-6259, because the other one is under repair), LabView 2016 32 bits, Windows 7 64 bits. I don't have access to RT system or FPGA.

 

The acquisition and the signal processing (2,3) seems to be fine in my application, but I struggle with the generation part. I have a while loop with the parts (1,2,3) running at a frequency of ~100 Hz creating a new command in a local variable. The command is read in a second loop where the generation is done, and here is my problem : how can I have the minimal latency when writting ?

 

Should I use a the regeneration mode ? If not how can I know how many sample the DAQ will need to the next cycle (no underflow and no over filling of the buffer)? If yes, is the buffer circular and can I chose its size ? Is there a better/different solution/configuration ?

Thank you in advance !

Max

0 Compliments
Message 1 sur 5
3 058 Visites

Any help would be appriciated ! 🙂

 

Max

0 Compliments
Message 2 sur 5
3 000 Visites

Hello,

 

You are on the french community. To optimize your answer rate, post your question in french.

 

Or you can go on the english part, which have more contributers.

http://forums.ni.com/t5/LabVIEW/bd-p/170

Best regards,

Michael

“En science, la phrase la plus excitante que l'on peut entendre, celle qui annonce des nouvelles découvertes, ce n'est pas "Eureka" mais c'est "drôle"
Isaac ASIMOV
0 Compliments
Message 3 sur 5
2 993 Visites

For minimal latency, you should use regeneration mode.

In continuous mode, DAQ Buffer could be set with "nb of sample on channel".

 

In this mode, only the first iteration will communicate with the DAQ, so for the others, frequency will be drive by the DAQ process.

“En science, la phrase la plus excitante que l'on peut entendre, celle qui annonce des nouvelles découvertes, ce n'est pas "Eureka" mais c'est "drôle"
Isaac ASIMOV
0 Compliments
Message 4 sur 5
2 991 Visites

Thank for your answer Michael ! Sorry I haven't seen that I were on the French part of the forum.

 

I'd like to be able to generate new data "on the fly". Currently, I call the DAQmx Write only when I need to send the new data (a single period of a sine wave is sent) and then the DAQ (or the computer, idk) regenarted it. My problem is when I change the frequency of the sine wave, it continues to regenerate the same amount of data, thus my signal is not continuous anymore (the phase jumps).

 

I have tried both options "Current position" and "First sample" for the "RelativeTo", different results are obtained but both with phase jump periodically in the signal after I change the frequency. I don't reallly understand the difference between the two options...

 

For the buffer size, the number of sampole sent to the DAQmx Write will define the "SW" buffer, but the "HW" buffer (which is 8191 S on my DAQ) can only be controlled with the command "->DAQmx Channel -> AO.DataXferReqCond", am I right ?

 

All the best,

Max

0 Compliments
Message 5 sur 5
2 984 Visites