Trend

This function block controls a trend writer in an HMI.

The input bShow is used to show or hide the HMI object. The update of the display is controlled with bUpdate. If the input is not connected then the display is redrawn automatically when the time corresponding to a pixel has passed. Therefore, the display changes very often at small time resolutions. That makes it more difficult to watch the signal courses and increases the processor load. The update rate is reduced by connecting a periodical bit signal (e.g. from a clock generator). Then the HMI object is only redrawn when a HIGH signal is connected to bUpdate and at least the time corresponding to a pixel has passed since the last update.

The input signal Values is used to provide the input data to be displayed. The trend writer displays up to 8 curves. Therefore, a vector can be connected, but only the first 8 vector elements are used for the trend display. Additional vector elements are ignored. The minimum and the maximum of the vertical scale are set via YMin and YMax. The time resolution in seconds is provided via the input fResolu. It corresponds with the period of the time that is displayed by the horizontal scale.

HMI object

The HMI object displays the temporal course of up to 8 signals.

Parameter

The mask designer is called as the parameter dialog via the context menu of the block. An HMI object of the type "Trend Writer” is assigned to the block by creating or selecting it. With the checkbox in the lower left corner you can switch between global and instanceable assignment.

Default settings for the HMI object are made in the corresponding dialog, which appears after "Additional settings …". The colors of the different elements as well as the font for the scale values are defined here. The object becomes transparent by deactivating the background and the draw field. If a font with anti-aliasing is used, in addition to the foreground color, several gradations up to the background color are used to smooth out edges during text output. If the resulting glimmering of the background color interferes when the object is transparent, it is recommended to change the background color or to choose a font without anti-aliasing.

Furthermore, the position, the range of values and the dividing of both scales are assigned in the dialog. The settings for the main tics determine also the position of the grid lines that can be deactivated too. Values between 0.1 and 999.999 seconds can be entered for the time resolution.
The HMI object uses a ring buffer to save the displayed signal values together with a time stamp. The length of the X-axis determines the needed amount of memory if automatic buffer size is configured. In this case the buffer contains twice as many elements as the X-axis consists of pixels. Alternatively, the buffer size can be assigned manually. The ring buffer covers always the time interval that is displayed on the X-axis. So, the buffer size defines the number of the sampling points for the curves. At short cycle times the ring buffer can be too small to keep all input values. Therefore, the minimum and the maximum of the input values are saved for every sampling point in the buffer. This method leads at small buffers to the display of two-line courses per signal that describe the envelope of the input values. The vertical connections between the courses of maximum and minimum indicate then the sampling points.

Signals

Name I/O Type(s) Function
Values I FLOAT, DOUBLE, UCHAR, WORD, LONG; LONGLONG Input values
YMax I FLOAT, DOUBLE, UCHAR, WORD, LONG; LONGLONG Maximum of the Y-scale
YMin I FLOAT, DOUBLE, UCHAR, WORD, LONG; LONGLONG Minimum of the Y-scale
fResolu I FLOAT Time resolution in second
bShow I BIT Show/hide object
bUpdat I BIT Update the trend display

Note: If inputs are not connected the object appears with the corresponding default parameters that have been entered in the mask designer. Otherwise the input signal from the function block overwrites the according setting from the parameter dialog.

Visualization

The assignment of the HMI object is displayed in the block by the color of the text boxes. A yellowish background indicates a global assignment. If the assignment is instanceable, the background is white. And at missing or incorrect assignment it is red.

Comments

The data type of the inputs Values, YMin and YMax is set by connecting any one of them.