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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

long non periodic signal generation

Hello,

 

I am starting with daq so sory if question is obvious

 

In my project I have to set very long output controll signals (non periodic) at very low rate ( 1 sample per 5 sec) and acquire data at faster rate lets say 1kHz and I want these signals to be synchronised and later after aquisition I need to draw some characteristics and calculate parameters.

 

Untitled.png

 

So I think that I will start generation and start read by trigger. when generation is done I will stop reading and start processing.

Is it wise to create big buffer for my write function put all signal there and then start generation? In my case buffer size is up to 200MB per channel.

Or should I put generated signal in smaller buffers lets say 1MB and when generation is done insert next buffer and start generate again? What will be delay while I insert this next part of my signal into buffer? Documentation says that X series supports retrigger so I wouldn't have to reset my read task. 

 

Thanks in advice

 

0 Kudos
Message 1 of 4
(4,313 Views)

Hello Pavel,

 

There is no problem with your question as every problem is hard that one cannot solve and easy if the solution is known:)

 

As far as I understand your question you want to do 3 things. I hope I am not wrong. 

 

1) Generate a low rate arbitrary voltage waveform on two channels.

2) Start collecting analog input values on multiple channels after a digital trigger event.

3) Analyze the input data.

 

My first hint would be to build your application with more modular concept based on LabVIEW examples.

- For the waveform generation I would advise you to have a look at the LabVIEW->Help->Find Example and then Browse for Hardware Input Output -> DAQmx -> Analog Output -> Voltage - Finite output. Try to test that example and modify it to your needs.

 

- After you have tested the output than you may extend your code with another block for Voltage acquisition. Go to find examples again and extend your code based on Hardware Input Output -> DAQmx -> Analog Input -> Voltage - Continous Input.vi Make sure you test that the SW and you see the expected waveform on the graph.

 

- For analysis I suggest a Producer consumer architecture, so the input loop can be a producer and the consumer would be another loop based on this example: Find Examples -> Fundamentals -> Queued Message Handler Fundamentals.vi Please observ that there is a loop that generates data based on events. In your case the analog input will generate waveforms periodically and that waveform array can be queued and processed in a paralell loop, so you do not have to buffer so much data in case your algorythm may allow paralell processing with acquisition.

 

 

- Please also observe that it is a good practice to keep error lines going all the way through your code. In your .png error lines have dead end.

 

I hope I could help.

 

Best regards,

András Bükkfejes

National Instruments

 

 

0 Kudos
Message 2 of 4
(4,284 Views)

Thanks for reply 🙂

 

I can handle app architecture but understanding daqmx is my problem now.

 

I have to run test that last near 4 hours depending on 4 controll signals that I generate. When doing that in finite samples I will have to put  that signals at once into buffer before start and it will take 1GB of ram to create that buffer. PC will have 4 or 8 GB ram so that is enough. I want to know if is there a better solution for that, less memory consuming?

 

As I understand this could be done in continious sampling when I will have to place new data into smaller buffer. But how can i replace that buffer in correct time to get the same effect like in finite samples?

 

Or is there other approach to that ?

 

0 Kudos
Message 3 of 4
(4,279 Views)

As far as I understand your application you have a relative slow sample rate. In this case it might be worths to try building a loop, reading a smaller ammount of waveform data from file and load it to the buffer. I think you should try this approach as it is relative easy to code it, and test if the output is suitable for your needs. In order to be more specific I would need more detailed description on your HW setup.

 

 

0 Kudos
Message 4 of 4
(4,270 Views)