LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

More Chart Bugs

I have two things happening right now that I think are bugs. (in 8.5.1)
 
1.) In a stripchart, if I sent the number of traces in chart to X, and then reduce the number of traces to X-n, the chart seems to keeps all of the memory required for X traces.  I am creating dozens of charts by duplicating a control and then later changing each control to it's required number of channels.  I couldn't figure out why I was getting a one time memory increase of 90+Mb.  If the chart I duplicate happened to contain a lot of channels (58 in this case) I got the burst when I duplicated it to create my others.  Setting the number of channels in the "copied" chart to 1 first, then duplicating, then setting it back to what it was, works, but shouldn't the chart get rid of the memory it is not using?  In an application that uses only a few chart controls you might have reason to keep the memory, but in an application with dozens of charts, the memory waste can be huge.  The only way for me to free memory from a chart that used to have lots of channels seems to be to Discard it and create a new one?.... boo .
 
2.) Log Scaling an axis when the axis has a non unity gain ends up with "garbage" labels.    I am plotting a FFT and setting the X axis gain so that x_axis shows the frequency rather then the "bin number" when I use "PlotY".  If I change the Graph to log scale I get divisions of 10 for the bin number not the frequency.  e.g.  A freq display of 0-1250Hz, with 256 fft points turns into division labels of 0.98, 9.76, 96.7, 967,etc in Log scale ... booooooooo..... 9.76 is the frequency resolution, so the divisions of 10 are picked using the bin number (pre gain), not the plotting scale (post gain)... this is wrong. 
 
On a related note, it is very annoying that my divisions are forced to multiples of 10 when in log scale.  For very common things like FFTs, Bode plots, etc. I need better then 10^x division resolution on a log scale  but don't seem to have that option with the CVI controls?  As it is,  if I want to show frequencies 750-1250, I have to show from 100 all the way to 10000.  This looks very bad since I don't have any data past 1250 and the plot uses less than 1/2 of the graph.

Greg
0 Kudos
Message 1 of 6
(4,192 Views)
Hello Greg,
 
Thank you very much for your input, I have some questions for you:
 
1) How are you changing the chart after you copy it? Also, how are you checking your memory usage (perfmon, etc)? If you already have some code that reproduces this that would be very helpful.
 
2) I will definitely look into this more. Again, if you already have some code that demonstrates this it would be very helpful.
 
 
As for the divisions for the log scale, a Corrective Action Request has been filed with our Research and Development department and this feature is currently slated to be released in a future version of LW/CVI.
 
Thank you very much for your input and I look forward to your response.
With warm regards,

David D.
0 Kudos
Message 2 of 6
(4,155 Views)
For 1.) I suppose it could be that windows is still temperarily holding the memory after it was freed, but typically when I free 100Mb, I see it right away.  I am using ProcessExplorer formally from SysInternals now from MS.
 
2.) I don't have a small app to duplicate this, but you don't even need code to see it. 
-Add a graph control to a UI. 
-Change its X axis gain to "12.34" and select Log scale. 
 
Now the X axis labels are "1.2, 12.3, 123.4, etc.".  That may appear "right" because they are powers of ten*gain, but I can't see where I would ever want it this way.  I want to see powers of 10 for my plot scale (post gain)... 10, 100, 1000, regardless of what the "x index" is.... What would make even more sense, is to let me choose the range of the X axis to whatever I want and the major grid divisions should fall on post-gain powers of 10 regardless of the axis min and max.
 
To put this into context, use my FFT plot example.  If I increase the number of points in my FFT, I get better freq resolution in the same frequency range.  My "xgain" changes with FFT points.  However, when I change the xgain, the axis labels change to new values.  ... ,0.97 to 0.46.to 0.38 etc.etc... boo.  This is very confusing and our customs don't understand why "I" pick "such confusing division labels.". 
 
To get around this, I have to use PlotXY and calculate the relative X points instead of changing the axis gain.  However, I like the XGAIN feature and I think ti should work as well in Log Scale as it does in a linear scale.
 
Greg
0 Kudos
Message 3 of 6
(4,148 Views)

Hello Greg,

It looks like both of these are expected behaviour for LW/CVI as it is currently, however I can definitely see the possible value in the features you bring up.

I would really urge you to create a product suggestion (or 2) here to let us know what you would like to see in a more formal way than the forum. We really value our customers input and I appreciate you taking the time to post. Please continue to let us know in the future of any ideas you have for improving CVI or any of our products, we love to hear from you.

With warm regards,

David D.
0 Kudos
Message 4 of 6
(4,119 Views)
Hi Greg,

Let me clarify something about the gain issue. There are two types of gain (and offset) that you can use with the CVI graph controls. One you do by applying the gain to the data itself, and the other you do by applying it to the axis. So far, you've been talking about the second case. This type of gain, which you can set for the entire axis, is really just a cosmetic multiplier that is applied to all the axis numeric labels. Its intent is primarily to allow people to have a quick and dirty way to change the graph units (for example, from seconds to hours). I do agree with you that using this with a log axis is probably not something that makes a lot of sense. Which is why you probably should use the other type of gain, which you can do with the PlotWaveform function. The only difference between the PlotWaveform and the PlotY function is that the former allows you to set the gain and offset for your data (it's called y_gain for the y-axis, and x_increment for the x-axis). Setting this gain, instead of the other one, would do what you want, I think.

Note that the both methods are equivalent if you only have one plot in the graph (or if you want the same gain applied to all plots) and you're using a linear axis. But when you use a log axis, then their effects are different. If you want the gain multiplier effect to be applied before the logarithmic mapping, then you should set it in the PlotWaveform function instead.

Concerning the issue of the memory usage of the strip chart control: it is the case that the memory manager in CVI rarely returns freed memory back to the system. For optimization purposes, it makes the assumption that memory that was freed (not necessarily by you, but by the individual controls, or other objects in CVI) will, more likely than not, be needed again in the future, and so it holds on to it, in order to avoid the overhead of re-obtaining it from Windows.
If you really want to free the memory completely, there is something you can do. It sounds weird, but if you create and then immediately destroy a panel, the CVI memory manager should free up system memory at that point (discarding a panel is one of those times when memory is returned to the system).

Hope this helps

Luis


0 Kudos
Message 5 of 6
(4,103 Views)
Thanks Luis.
 
Both are excellent options.
 
I realize that axis gain is simply cosmetic, but I think it should still remain be "hidden" from the user.  The "quick and dirty" feature shows its roots in log scale, but PlotWaveform will do the trick, thanks.
 
I've submitted a feature request for better Log scale plot options. (using none powers of ten for min/max axis)
 
Greg
0 Kudos
Message 6 of 6
(4,075 Views)