LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

buffered output 9402

Solved!
Go to solution

I have a task to output a very long sequence with very accurate timings, ie, I should  use buffering. But the sequence can be length for a few days, and it is not known exactly how much (until the user stops), so that the pre-form the entire buffer is unrealistic.
Also I have no devices and work on the simulator.
NI 9402, cDAQ-9188
My VI:

DO.png


generating array is simplified, now it does not matter.
In the simulation I see dt = 500 ms, so I conclude that the DAQmx write function is waiting until the free space will appear in the buffer.
Customer run VI at real device, and dt <70 ms, ie waiting is not observed.
Where a mistake, how to incorporate the expectation?
"wait mode" is not like the decision, because all cases are waiting, just with a different CPU usage.

0 Kudos
Message 1 of 6
(3,878 Views)

Hello,

 

Can you attach your code? I can try to run it with the same hardware. 

 

I will like to check the array operations that as you may understand are usually consuming a lot of memory due the data movement. The Insert into array function implies a lot of memory allocations. Do you have any idea of the final size of that array? Is that is the case we can create an "empty" dummy array and use in Place structure to reduce the memory consumption. 

 

I also want to let you know that if you have really critical timing I will recommend you the cRIO platform instead of the Ethernet cDAQ. As you may know you can have a certain amount of control over the timing using DAQmx, however the task is not going to be deterministic. If you decide to use Real Time or FPGA you can have really accurate and deterministic tasks.

 

I will be waiting for your code, something important to consider is that the simulated devices have limited functionalities.

 

Regards,

Randy @Rscd27@
0 Kudos
Message 2 of 6
(3,842 Views)
Solution
Accepted by topic author Artem.SPb

I send snippet of my code in first message.
Now I've modified it like this, it works. Output buffer should be reserved by "conf output buffer" vi.

do.png

Inside loop really not necessary.

 

 

As for your idea to reserve dummy array, it very strange. The experiment may be longer than week. And for one week I need 604 800 000 points (1kHz). Impossible reserve such buffer.

0 Kudos
Message 3 of 6
(3,835 Views)

Hello Artem

 

The dummy array idea is presented as part of the Topics of the LabVIEW Performance National Intruments course which I teach regurarly. This allows the user to get the benefits of "In placeness" in LabVIEW by using the In Place structure:

 

https://www.ni.com/docs/en-US/bundle/labview/page/in-place-element-structures-increasing-memory-effi...

 

However the In Place structure cannot be used to add or remove elements of an array and only to substitude. That is why if you create an array with the number of elements you need, full of zeros you can use the place structure tu add values add the end by doing a substitution of the existing zeros. The reason why this is more efficient, is becayse you will be using the same memory space. for example if you create a 1-D array of 100 elements of 32 bits LabVIEW assigned 3232 bits (3200 for the values and 32 bits for the index) and if you add a new value LabVIEW will have to move the 3232 bits to a new location and add the new 32 bits. On the other hand if you a 1- D array of 1000 elements filled up with "0" and you change the value 101 you will not need to do memory allocation with all the 1000 elements.

 

I asked for your code to avoid having to write it again. I am glad that know is working.

 

I was not suggesting to reserve a buffer for that, if not that you create an array of 604 800 000 points to avoid memory allocation inside the loop.

Randy @Rscd27@
0 Kudos
Message 4 of 6
(3,811 Views)

Randy, thanks for lesson, but it not necessary.
I know about In Place structure and many other functions in LabVIEW.

I use initialise array only for simplify my example code. Real prgramm uses difficult subVI fo generate correct sequence of values

As for code, do you know about snippet?

Message 5 of 6
(3,797 Views)

Hello Artem.SPb,

 

I was not aware of that. As you may have seen I am not very active on the forum. But thanks for the update.

 

If you still have troubles with the code, please let me know by a pm message and I will create a Service Request for you.

 

 

Warm Regards,

 

Randy Cespedes

Applications Engineering

National Instruments

www.ni.com/support 

Randy @Rscd27@
0 Kudos
Message 6 of 6
(3,791 Views)