04-01-2006 03:56 AM
Hallo Community, I must write a visualization surface for a laboratory unit.
I use the Graph Control Functions, PlotLine to show the trends of the controller sizes.
This function draws every 1/10 sec. a point into the Graph.
My problem is, that after 600 sec. or 6000 point the CPU capacity is on 100%,
without change of the memory usage.
Thanks for the help
Gerhard
04-03-2006 10:19 AM
04-03-2006 10:57 AM
Hello,
this code run in a timer loop with "updateTime" = 0,2sec.
Thanks for help
Gerhard
// Trendfunktionen Druckregler
if (Trend_Druck == 1)
{
// Sollwert W
GetCtrlVal(rk3, RK3_Druck_Sollwert, &Wvalue); // Sollwert auslesen
PlotLine(trend_druck, Trend_P_Trend_P_Graph, (stepGraph - updateTime), Wvalue_old, stepGraph, Wvalue, VAL_BLUE);
Wvalue_old = Wvalue;
// Regelgröße X
GetCtrlVal(rk3, RK3_Druck_Istwert, &Xvalue); // Istwert auslesen
PlotLine(trend_druck, Trend_P_Trend_P_Graph, (stepGraph - updateTime), Xvalue_old, stepGraph, Xvalue, VAL_RED);
Xvalue_old = Xvalue;
// Stellgröße Y
GetCtrlVal(rk3, RK3_Druck_Stellgroesse, &Yvalue); // Stellgröße auslesen
state = PlotLine(trend_druck, Trend_P_Trend_P_Graph, (stepGraph - updateTime), Yvalue_old, stepGraph, Yvalue, VAL_YELLOW);
//
SetPlotAttribute(trend_druck, Trend_P_Trend_P_Graph, state, ATTR_PLOT_YAXIS, VAL_RIGHT_YAXIS);
Yvalue_old = Yvalue;
// Zeit-Schritt
stepGraph = stepGraph + updateTime;
// X-Achse weiterlaufen lassen, wenn 5% vor Xmax
GetAxisScalingMode(trend_druck, Trend_P_Trend_P_Graph,VAL_BOTTOM_XAXIS, VAL_MANUAL, &Xmin, &Xmax);
if (stepGraph > (Xmax - ((Xmax - Xmin) * 0.05)))
{
SetAxisScalingMode(trend_druck, Trend_P_Trend_P_Graph,VAL_BOTTOM_XAXIS,
VAL_MANUAL, (Xmin + 1), (Xmax + 1));
}
}
04-03-2006 06:08 PM
Hello Gerhard.
I did not see any calls to DeleteGraphPlot() in your code.
Unless you set ATTR_DATA_MODE for your graph to VAL_DISCARD, the plot data will be retained in memory, and eventually this will cause you problems. The default value of this attribute is VAL_RETAIN. Unfortunately, you actually need to retain the data so that plots will not disappear when you rescale the graph.
Here is my suggestion:
Hope this helps.
Regards,
Colin.
04-04-2006 05:49 AM