03-03-2024 08:00 PM - edited 03-03-2024 08:02 PM
Thank you Altenbach, Ben, and Bob Schor for your contributions.
My objective is to obtain data from a DAQ and exhibit it in a picture control. The process works smoothly when I continuously draw the data from the DAQ buffer in the picture control. However, when I attempt to load the complete data from a file into the picture control, it consumes a substantial amount of memory. I am striving to achieve a similar outcome as the pen plotter application. In this application, there is a predefined template that includes axis scales, notes, annotations, limit lines and images. My goal is to draw the acquired data within this predefined template.
Find the Template and update vi attached
03-06-2024 12:31 AM
I haven't looked at the code other than the screenshot, which doesn't show using the template picture. Here are a couple of directions which may help you:
03-06-2024 07:41 AM
Hello, Balaji.
Your signature says it all. You have gotten consistent advice that the Picture Control is (spectacularly) not suited for the task you want to give it. But you persist, and fail. I can only hope (for your sake) you are your own boss. I hope you resolve your difficulties to your satisfaction.
Bob Schor
03-06-2024 01:30 PM - edited 03-06-2024 01:53 PM
I made a test case to evaluate the picture control performance.
I acquired data from my DAQ module at the rate of 1 KHz and continuously plotted the data in the picture control for around 30 minutes (1200000 samples), I didnt faced any performance issues. I recorded the data stream and loaded the recorded data into the picture control and I dont face any performance issues, after I changed the line width and plotting in chunks.
Perviously I tried with 45 seconds data (45000 samples) and it crashed.
I attached the data plot
03-06-2024 03:38 PM
Thank you for your interesting statistics. Just for fun, I generated one million points that created a circular ring by plotting r exp(i theta), where r was a random dbl between 250 and 300 and theta was another random dbl between 0 and 2 pi. The whole thing, generating and plotting 1 million points on an XY graph (using the really tiny dot symbol) took 0.12 seconds. It did not hang up anything. If I plotted lines instead of points, it went a little faster. But that was just a single test of each.
So I tried a billion points! Oops, memory is full. But 10 million takes (as one might expect) about a second.
Bob Schor
03-07-2024 04:50 AM - edited 03-07-2024 05:02 AM
Note that the picture control's line width makes a huge difference.
In your original VI, 30000 lines with 2 pixel width actually messes up my system. 50000 lines at 1 pixel is no problem.
This is a GDI problem, so there's not much LabVIEW can do about it.
See: Simple graphics bring LV to it's knees - NI Community (TL;DR: Lines with width >1 are apparently drawn as polygons. )
Also mentioned here: Solved: Draw picture slow down - NI Community
I have applications where I draw multiple 1 pixel lines, as that's still faster than one 2 pixel line.
And of course, implementing your own Bresenham’s Line Generation Algorithm - GeeksforGeeks is a lot of fun! Takes me back to the '90's 👴.
03-07-2024 10:11 AM
The Draw multiple lines have some strange code in it, i assume at some time Array size had an I16 as output and the rearraging loop can at least be parellellized, if not simplified with a Word switch.
All that is moot though, as simply plotting in an XY graph is very fast and easy and you can inject the full array without issue.
03-07-2024 10:26 AM - edited 03-07-2024 10:26 AM
Strange!
I wanted to mess with the VI so i saved a copy and it's instant! Somehow the LLB causes issues? Or just the recompile did it?
03-07-2024 10:37 AM
Ok, so i just resaved the VI outside the LLB and removed the unnessecary I32 convertions and now i can do a Plot All in 17ms!
03-07-2024 10:54 AM
@Yamaeda wrote:
Ok, so i just resaved the VI outside the LLB and removed the unnessecary I32 convertions and now i can do a Plot All in 17ms!
With a line width of 2 and 40000 coordinates, this still completely ruins my entire PC, to a point even the mouse pointer isn't moving.
It's the GDI bug...