LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reduce System Memory Usage While Saving Waveforms

Solved!
Go to solution

Made a few updates. Also took snippet since I think people prefer that.

 

csv snippet.png

0 Kudos
Message 11 of 16
(1,434 Views)

One there is a bug in your code.

  1. Assume I have 100 points in your tester.
  2. dt equals 0.001
  3. The final time should be 0.099 (Starts at 0, hundred points later including 0 is 0.099)

Look below at your spreadsheet, mine is next to it as a comparison.

Snap25.png

Can you see the difference in numbers? (dt is 0.001) Can you identify your sheet?

 

Below is a NEW working version that should sip less memory and maybe faster as some loops are parallelized. The zip file is saved in LabVIEW 2018.

 

All you need to do is change the precision and default data directory.

snip.png

 

mcduff

 

 

0 Kudos
Message 12 of 16
(1,418 Views)

I noticed this issue when I was doing some testing earlier. I think I'm giving one more digit of precision than is necessary in the "number to fractional string" and then I'm likely experiencing a rounding error due to that.

 

Your solution is very clean. I've got some work to do and lots to learn... thank you for your guidance, I really appreciate it.

0 Kudos
Message 13 of 16
(1,400 Views)

@nickb34 wrote:

I noticed this issue when I was doing some testing earlier. I think I'm giving one more digit of precision than is necessary in the "number to fractional string" and then I'm likely experiencing a rounding error due to that.


Look at the Help for Ramp.

Snap28.png

You need to set the "exclude end?" to True. Then it should be okay.

 

Good luck.

 

Cheers,

mcduff

0 Kudos
Message 14 of 16
(1,395 Views)

That's great... I put in a some logic to counter that issue and I got most of the way there, but setting that to true allowed me to remove all of that and it works correctly now. 

0 Kudos
Message 15 of 16
(1,390 Views)

I glad it works for you.

 

I gave you that last example as it may be easier to modify it in the future.

 

Because it uses a fixed string array (the 2d array on the shift register) you can do the following:

  1. Convert numbers into strings one-by-one. Why would you want to do this? You can use the # in your format specifier to delete trailing 0's. So instead of saving 0.10000, you save 0.1. This makes your end file smaller.
  2. You can start to handle cases if you have an unequal number of points. After a write to the file, set all the elements of the fixed string array to an empty string. This way when you write the CSV you don't have a bunch of extra 0's.

Think a bit about the case where you might need to modify in the future.

 

mcduff

Message 16 of 16
(1,384 Views)