Class DsTrendCurve
Version 1.0
Modified 26-MAY-2023 14:29:27.00
 Stores data for a trend graph.

 In one DsTrendCurve object, up to 10 attributes can be specified.
 The attribute values will be stored with the same frequency, and the
 curves will be plotted in the same trend window.

 The names of the attributes is specified the the Attribute array.
 For every attribute, a storage area object also has to be specified.
 An attribute may be referred to by several different DsTrendCurve
 objects, for example to store at different frequencies.

 The sampling rate is specified the the ScanTime attribute.

Storage buffers
 Storage buffers has to be supplied by the user, one buffer for the time axis data, and
 one for each configured attribute. Object of type CircBuffer has to be used, eg
 CircBuff1k, CircBuff2k, CircBuff10k, CircBuff20k, CircBuf100k and CircBuff200k.
 A CircBuff1k object will for example store 250 samples of size 4 bytes and a
 CircBuff200k 50000.

Data types
 The datatypes that can be stored is
 - pwr_tFloat32, pwr_tFloat64
 - pwr_tInt32, pwr_tUInt32, pwr_tInt16, pwr_tUInt16, pwr_tInt8, pwr_tUInt8

 The time is stored as one or two UInt32, dependent on the selected TimeResolution.
 The default time is of size 4 bytes where the seconds from epoch is stored. With time
 resolution nanoseconds the size is 8 bytes, and one word with the nanoseconds are added
 for each sample.

Server
 DsTrendCurve objects is handled by the fast server rt_trend.
 The base frequency for the fast server process is configured in
 the DsTrendConf object.

User storage
 Trend data can be stored by a user defined server, for example by the plc program.
 In this case a number of setting has to be done:
 - Function is set to 1.
 - AttributeType should be set, eg pwrs:Type-$Float32.
 - Attribute should be set to an arbitrary attribute. The only function for the attribute
   is the curve name.
 - ScanTime should be set to the time difference between two samples.
 In the Buffer object, the Size (max number of samples) and ElementSize in bytes should be set.
 To fill in the samples the functions cbuf_AddSample() and cbuf_AddTimeSample() can be used.
 In this example the trend is filled in from a DataArithm where the data buffer is connected
 to Da1 and the time buffer to Da2.

   classdef Da1 CircBuff10k;
   classdef Da2 CircBuff20k;
   pwr_tTime time;

   time_GetTime(&time);
   cbuf_AddSample(Da1, &A1);
   cbuf_AddTimeSample(Da2, &time);

Se also



RtBody attributes pwr_sClass_DsTrendCurve
String80 Description   Optional text.
String80 Title   Title of the trend window.
Mask Function   Trend function.
Float32 ScanTime   Scantime in seconds. Multiple of the base scantime configured in DsTrendConf object.
Array of TypeId AttributeType   The attribute type only has to be set if UserStorage
is used, where the type is set in the form pwrs:Type-$Float32.

Stores measurants data types. It has to be of any of
the types pwr_tBoolean, pwr_tFloat32, pwr_tFloat64,
pwr_tInt8, pwr_tInt16, pwr_tInt32, pwr_tUInt8,
pwr_tUInt16, or pwr_tUInt32.
Array of AttrRef Attribute   The complete name of analog sampled attributes, for
example PROC1-TEMP1.ActualValue. The attributes have to
be represented by local objects.
Array of AttrRef Buffers   Data buffers. Circular buffer objects that contains the data of the curves.
AttrRef TimeBuffer   Time buffer. A circular buffer object that contain the time axis data for the curves.
TimeResolutionEnum TimeResolution   Resolution of time scale, seconds or nanoseconds.
Seconds will require 4 bytes per sample, and nanoseconds 8 bytes per sample.
Float32 StorageTime   Length, in seconds, of the storage. If the time
exceeds what is possible to store in DataBuffer, the
storage is stopped when DataBuffer has been filled.
Float32 DisplayTime   Length, in seconds, of the storage that is displayed
in the trend window.
UInt32 DisplayResolution   Length, in seconds, of the storage that is displayed
in the trend window.
Float32 DisplayUpdateTime   Time between updates of the curve display in seconds.
CurveLayoutMask Layout   Curve window layout.
UInt32 NoOfSample   Number of samples.
UInt32 FirstIndex   Specifies the first element in the data buffer with valid data.
UInt32 LastIndex   Specifies the last element in the data buffer with valid data.


Template Object
ScanTime 1
StorageTime 200
DisplayTime 200
DisplayResolution 1
DisplayUpdateTime 1


Attributes detail


Description Attribute
Class Attribute
Type String80
Flags
Body RtBody
 Optional text.

Title Attribute
Class Attribute
Type String80
Flags
Body RtBody
 Title of the trend window.

Function Attribute
Class Attribute
Type Mask
Flags REDUTRANSFER
Body RtBody
 Bitmask for trend function.
 - UserStorage    1     Data inserted by user.

ScanTime Attribute
Class Attribute
Type Float32
Flags REDUTRANSFER
Body RtBody
 Scantime in seconds. Multiple of the base scantime configured in DsTrendConf object.

AttributeType Attribute
Class Attribute
Type Array of TypeId
Flags ARRAY
Elements 10
Body RtBody
 The attribute type only has to be set if UserStorage
 is used, where the type is set in the form pwrs:Type-$Float32.

 Stores measurants data types. It has to be of any of
 the types pwr_tBoolean, pwr_tFloat32, pwr_tFloat64,
 pwr_tInt8, pwr_tInt16, pwr_tInt32, pwr_tUInt8,
 pwr_tUInt16, or pwr_tUInt32.

Attribute Attribute
Class Attribute
Type Array of AttrRef
Flags ARRAY
Elements 10
Body RtBody
 The complete name of analog sampled attributes, for
 example PROC1-TEMP1.ActualValue. The attributes have to
 be represented by local objects.

Buffers Attribute
Class Attribute
Type Array of AttrRef
Flags ARRAY
Elements 10
Body RtBody
 Circular buffer objects that contains the data of the curves.
 Objects for the databuffers has to be configured by the user. The extent of the
 buffer attributes should equal or exceed the storeage size, i.e. the size of the
 sampled attribute's type multiplied by NoOfSample.

TimeBuffer Attribute
Class Attribute
Type AttrRef
Flags
Body RtBody
 Time buffer. A circular buffer object that contain the time axis data for the curves.
 The object for the time buffer has to be configured by the user. The extent of the
 buffer attributes should equal or exceed the storeage size for the time data.

TimeResolution Attribute
Class Attribute
Type TimeResolutionEnum
Flags
Body RtBody
 Resolution of time scale, seconds or nanoseconds.
 Seconds will require 4 bytes per sample, and nanoseconds 8 bytes per sample.

StorageTime Attribute
Class Attribute
Type Float32
Flags
Body RtBody
 Length, in seconds, of the storage. If the time
 exceeds what is possible to store in DataBuffer, the
 storage is stopped when DataBuffer has been filled.

DisplayTime Attribute
Class Attribute
Type Float32
Flags
Body RtBody
 Length, in seconds, of the storage that is displayed
 in the trend window.

DisplayResolution Attribute
Class Attribute
Type UInt32
Flags
Body RtBody
 Length, in seconds, of the storage that is displayed
 in the trend window.

DisplayUpdateTime Attribute
Class Attribute
Type Float32
Flags
Body RtBody
 Time between updates of the curve display in seconds.

Layout Attribute
Class Attribute
Type CurveLayoutMask
Flags
Body RtBody
 Curve window layout.

NoOfSample Attribute
Class Attribute
Type UInt32
Flags STATE | INVISIBLE
Body RtBody
 Number of samples.

FirstIndex Attribute
Class Attribute
Type UInt32
Flags STATE | INVISIBLE
Body RtBody
 Specifies the first element in the data buffer with valid data.

LastIndex Attribute
Class Attribute
Type UInt32
Flags STATE | INVISIBLE
Body RtBody
 Specifies the last element in the data buffer with valid data.