Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how to create and erase waveform

Hi from France ; we're working with National Components under .NET / C#.

We record waves cycles : each curve = 1000 points, two curves for each complete cycle. During test, every points of every curves are temporary recorded in RAM.

An own design tool is used to show the history of our previous records... Two techniques : first, you select one cycle and we draw on the PC Monitor, only the two matching curves, second, you check a special case and every curves are drawn. In my example, we've got 50 cycles in memory (100 curves).

Each time we wish to draw one curve, we use the method AddCurve() detailed below, and the method RemoveCurve(), when we want to erase the curves, by uncheck the previous case for example.

The problem is when we check the case the first time, the run time is short, even for 50 curves (less than 2 s). After, when I uncheck, the curves disappear in a similar timing (less than 1 s). But if I do the same operation another time (check / uncheck), the time will be multiplicate by two (4 / 2 s)... And by two again if another time (8 / 4 s) and so on... If I shunt the two next methods in my code, the runtime doesn't change... So, I guess I do a mistake in it but I don't know which one... Got an idea, please ???

sample of code

// variable globale

public

NationalInstruments.UI.WindowsForms.WaveformGraph mobjGraphe;

// the following method is called each time we want to draw a new curve

// So, if we want to draw 50 curves, this methode is called 50 times

// dCoordonnees[] sont les ordonnées de la courbe

// dDepartX est l'abscisse de premier point (échelle temporrelle)

// dIncrement est le pas entre chaque point

public void AddCurve( double[] dCoordonnees , double dDepartX , double dIncrement )

{

WaveformPlot objWaveformCourbe =

new NationalInstruments.UI.WaveformPlot();

objWaveformCourbe.HistoryCapacity = dCoordonneeY.Length ;

// set the strating point

objWaveformCourbe.PlotY( dCoordonneeY, dDepartX , dIncrement );

// add curve to graph object

mobjGraphe.Plots.Add(objWaveformCourbe);

}

// this method is called only one time

public

void RemoveCurve()

{

// erase definitively curve from object

mobjGraphe.Plots.Clear() ;

mobjGraphe.ClearData() ;

}

0 Kudos
Message 1 of 2
(3,035 Views)

Hello Seb,

I suggest you to take a look at the following post. Your problem is surely link to the Garbage Collector.
- "Memory problem with Waveform Graph control   [ NOUVEAU ]" : http://forums.ni.com/ni/board/message?board.id=232&message.id=1967&jump=true

Best regards,

0 Kudos
Message 2 of 2
(2,973 Views)