TrnEventSetTableMS
Sets event trend data and time data (including milliseconds) for a specified trend tag. The event trend data is set in an event table, and the time stamp in time tables. Data is set at the period specified, working backwards from the starting point specified by EventNo.
If the period of setting data differs from the trend period (defined in the Trend Tags database), the values to be set are calculated from the trend data, either averaged or interpolated. The user needs to have the correct privilege (as specified in the Trend Tags form), otherwise the data is not written.
This function is a blocking function. It blocks the calling Cicode task until the operation is complete.
Syntax
TrnEventSetTableMS(Tag, EventNo, Period, Length, Table, TimeTable, MSTimeTable [, ClusterName] )
Tag:
The trend tag enclosed in quotation marks "" (can be prefixed by the name of the cluster that is ClusterName.Tag).
EventNo:
Event Number:
Period:
This will be the interval (in seconds) between trend values when they are set (that is it will be the perceived sampling period for the trend). This period can differ from the actual trend period. Set to 0 (zero) to default to the actual trend period.
Length:
Number of trend values in the trend table.
Table:
Table of floating-point values in which the trend data is stored. You can enter the name of an array here (see example).
TimeTable:
Table of integer values in which the time stamp is stored. If you would like events to stay in correct time-stamp order, sort the values in this table in ascending order. When EventNo is non-zero the values in this table may be zero. This will result in the values of the requested events being overwritten but the timestamps staying the same.
MSTimeTable:
The table of integer values in which the millisecond component of the time stamp is stored.
ClusterName:
The name of the cluster in which the trend tag resides. This is optional if you have one cluster or are resolving the trend via the current cluster context. The argument is enclosed in quotation marks "".
Return Value
The actual number of samples written. The return value is 0 if an error is detected. You can call the IsError() function to get the actual error code.
Related Functions
Example
// Arrays for trend data
REAL garSingleValue[1];
INT ganSingleTime[1];
INT ganSingleMS[1];
// Push the data in the trend system
INT
FUNCTION LogTrend(STRING sTagName, REAL rValue, INT nDateTime, INT nMS)
INT nSamplesWritten;
garSingleValue[0] = rValue;
ganSingleTime[0] = nDateTime;
ganSingleMS[0] = nMS;
nSamplesWritten = TrnEventSetTableMS (sTagname, 0, 0, 1, garSingleValue[0], ganSingleTime[0], ganSingleMS[0], "ClusterXYZ");
RETURN nSamplesWritten;
END
See Also