03-15-2016 03:06 PM
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:
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.
Solved! Go to Solution.
03-16-2016 11:52 AM
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,
03-16-2016 04:19 PM
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.
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.
03-17-2016 04:04 PM - last edited on 01-08-2024 11:27 AM by migration-bot
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:
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.
03-17-2016 04:15 PM - last edited on 01-06-2025 10:58 AM by Content Cleaner
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?
03-17-2016 04:23 PM
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