Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

DspTrend

  • Last UpdatedJul 18, 2023
  • 2 minute read

Displays a trend at an AN. Values are plotted on the trend pens. You need to specify Value1, but Value2 to Value8 are optional. If more values (than configured pens) are specified, the additional values are ignored. If fewer values (than configured pens) are specified, the pens that have no values are not displayed.

DspTrend() is optimized so that it will not display the trend until a full set of samples has been collected. For example, if you have defined 100 samples for your trend, the trend will not display until value 100 is entered.

You should use this function only if you want to control the display of trends directly. If you use the standard Trends (defined in the Trends database) this function is called automatically.

Note: This function was designed to only be used on Cicode objects, or the animation point object from the version 3.xx/4.xx toolbox.

Syntax

DspTrend(nAN, Trend, Value1 [,Value2 ... Value8] )

nAN:

The AN where the trend will be displayed.

Trend:

The name of the trend to display in the format <[LibName.]TrnName>. If you do not specify the library name, a trend from the Global library will display (if it exists).

To display a Version 1.xx trend, specify the trend number (0 to 255). For example, if you specify trend 1, Plant SCADA displays the trend Global.Trn001.

Value1:

The value to display on Pen 1 of the trend.

Value2...8:

The values to display on Pen 2...Pen 8 of the trend (optional).

Return Value

0 (zero) if successful, otherwise an error is returned.

DspDel

Example

/* Using the main_loop trend (from the trends library) at AN25,
display a value of 10 on Pen1, 20 on Pen2, 30 on Pen3 and 40 on
Pen4 of the trend. */
DspTrend(25,"Trends.Main_Loop",10,20,30,40);
/* Using trend definition 5 (Plant SCADA Version 1.xx)
at AN25, display a value of 10 on Pen1, 20 on Pen2, 30 on Pen3 and
40 on Pen4 of the trend. */
DspTrend(25,5,10,20,30,40);
/* Using the loops trend (from the global library) at AN26,
display a value of 100 on Pen1 and 500 on Pen2 of the trend. */
DspTrend(26,"Loops",100,500);
/* Display a trend configured with 100 samples immediately. The
data for the first 100 samples is stored in an array -
MyData[100]. On first display, grab all the data and call
DspTrend().*/
FOR i = 0 to 100 DO

DspTrend(AN, "Loops", MyData[i]);

END
// display new samples every 300ms
WHILE TRUE DO

// Shift MyData down and grab new sample

TableShift(MyData, 100, 1);

MyData[99] = MyFastData;

DspTrend(AN, "Loops", MyData[99]);

SleepMS(300);

END
/* Display a trend configured with 100 samples immediately. Dummy
data is pushed into the first 100 samples to fill the trend. Once
these values are entered, the trend will be updated each time a
new sample value is entered.*/
// fill up the trend.
FOR i = 0 to 100 DO

DspTrend(AN, "Loops", 0);

END
// display new samples every 300ms
WHILE TRUE DO

DspTrend(AN, "Loops", MyFastData);

SleepMS(300);

END

See Also

Display Functions

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in