Getting Started with Trend Visualization Permalink

When you execute a trend, it is best to proceed with user guidance and the help of the trend wizard.

Development of a visualization with trend

  1. Create an empty standard project and program at least one variable into ‎PLC_PRG‎.

    ‎PLC_PRG‎ is declared and implemented

  2. Add the “Visualization” object to the device tree below “Application”.

    An empty visualization appears.

  3. Open “ToolBox  Special Controls”.

  4. Drag the “Trend” element to the visualization

    The “Trend Recording” dialog with the “Record Settings” opens.

  5. Select the task in which the trend recording will be executed.

    In general the trend recording runs in the same task as the main program, i.e. PLC_PRG.

    Therefore, select ‎MainTask‎.

  6. Add a trend variable with “Add Variable” and assign an IEC variable from PLC_PRG to the trend variable.

  7. Click “OK” to close the “Trend Configuration”.

    There is a recently created "Trend Recording" object below the “Trend Recording Manager”. The active visualization contains a “Trend” element that is selected.

  8. Click “Visualization  Insert elements for controlling trend elements”.

    The “Trend Wizard” dialog opens.

  9. By default, all three controls are activated in the dialog. Click “OK” to exit the dialog.

    The active visualization contains a trend with controls.

  10. Set the application containing the trend objects to active.

  11. Compile the application with [F11].

  12. Execute the “Online  Login” command.

  13. Start the application with [F5].

    The target visualization appears. The visualization contains the trend diagram with the value curve of the variable. The controls enable user inputs.

Visualization of the sinusoidal trend of an IEC variable

The following objects are implemented in the project:

  • ‎PLC_PRG‎

  • ‎Visualization_Trend1‎

  • ‎VisuWithTrend‎

The ‎PLC_PRG‎ program runs as part of the application on the controller.

PROGRAM PLC_PRG
VAR
    iVar : INT;
    rSin : REAL;
    rVar : REAL;
END_VAR
iVar := iVar + 1;
iVar := iVar MOD 33;
rVar := rVar + 0.1;
rSin := 30 * SIN(rVar);
                        

‎Visualization_Trend1‎

‎Visualization_Trend1‎ is the object that contains the configuration of the trend recording.

_img_trend_recording_example.png

‎VisuWithTrend‎

‎VisuWithTrend‎ is the object that displays the trend.

The visualization contains four elements: one “Trend” and three controls. The properties of the trend are defined as follows.

Properties

Value

“Trend recording”

Visualization_Trend1

“Show cursor”

_cds_icon_option_activated.png

“Show tooltip”

_cds_icon_option_activated.png

“Show frame”

_cds_icon_option_activated.png

“Date Range Picker”

_visu_icon_date_range_selector.png: Trend1DateRangeSelector

“Time Picker”

_visu_icon_timeselection.png: Trend1TimeSelector

“Legend”

_visu_icon_legend.png: Trend1Legend

‎VisuWithTrend‎ at runtime

_img_trend_getting_startet_run.png