How to Create Trend Graph in HMI: Step-by-Step Guide
To create a trend graph in an
HMI, first configure the data tags you want to monitor, then add a Trend or Chart object in the HMI software, linking it to those tags. Set the time range and update rate to display real-time or historical data visually.Syntax
Creating a trend graph in HMI involves these main parts:
- Data Tags: Variables from the PLC that hold the values to display.
- Trend Object: The graphical element in the HMI software that plots data over time.
- Time Range: The period shown on the graph (e.g., last 5 minutes, 1 hour).
- Update Rate: How often the graph refreshes with new data.
plaintext
TrendGraph {
Tags: [Tag1, Tag2, ...];
TimeRange: 5min;
UpdateRate: 1s;
DisplayType: LineChart;
}Example
This example shows how to create a simple trend graph in a common HMI software (like Siemens WinCC or FactoryTalk View). It tracks a temperature sensor value over the last 10 minutes, updating every second.
plaintext
1. Define a data tag named <code>TemperatureSensor</code> linked to your PLC. 2. Insert a Trend or Chart object on your HMI screen. 3. Configure the Trend object properties: - Add <code>TemperatureSensor</code> as the data source. - Set <code>Time Range</code> to 10 minutes. - Set <code>Update Rate</code> to 1 second. 4. Save and run the HMI project to see the live trend graph.
Output
A line graph showing temperature changes over the last 10 minutes, updating every second.
Common Pitfalls
Here are common mistakes when creating trend graphs in HMI:
- Not linking the trend to the correct data tags, so no data appears.
- Setting the update rate too slow or too fast, causing lag or excessive CPU use.
- Choosing an inappropriate time range that hides important data or overloads the graph.
- Forgetting to enable data logging if historical trends are needed.
Always verify tag connections and test the graph live.
plaintext
/* Wrong: No data tags linked */ TrendGraph { Tags: []; TimeRange: 5min; UpdateRate: 1s; } /* Correct: Proper tag linked */ TrendGraph { Tags: [TemperatureSensor]; TimeRange: 5min; UpdateRate: 1s; }
Quick Reference
| Step | Description |
|---|---|
| Define Data Tags | Create PLC variables to monitor. |
| Add Trend Object | Place a trend/chart element on HMI screen. |
| Link Tags | Connect data tags to the trend object. |
| Set Time Range | Choose how much history to display. |
| Set Update Rate | Decide how often the graph refreshes. |
| Enable Logging (Optional) | Store data for historical trends. |
Key Takeaways
Always link your trend graph to the correct PLC data tags to see live data.
Set an appropriate time range and update rate for smooth and meaningful trends.
Enable data logging if you want to view historical trends beyond real-time data.
Test your trend graph live to ensure it updates and displays data correctly.
Avoid too frequent updates to reduce CPU load and ensure stable HMI performance.