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.
TrnEventSetTableMS(Tag, EventNo, Period, Length, Table, TimeTable, MSTimeTable [, ClusterName] )
The trend tag enclosed in quotation marks "" (can be prefixed by the name of the cluster that is ClusterName.Tag).
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.
Number of trend values in the trend table.
Table of floating-point values in which the trend data is stored. You can enter the name of an array here (see example).
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.
The table of integer values in which the millisecond component of the time stamp is stored.
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 "".
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.
// Arrays for trend data
// Push the data in the trend system
FUNCTION LogTrend(STRING sTagName, REAL rValue, INT nDateTime, INT nMS)
garSingleValue = rValue;
ganSingleTime = nDateTime;
ganSingleMS = nMS;
nSamplesWritten = TrnEventSetTableMS (sTagname, 0, 0, 1, garSingleValue, ganSingleTime, ganSingleMS, "ClusterXYZ");