Scale the analog input in the PLC input mapping FC, log the engineering value and its setpoint in an HMI data log at a sensible cycle, and show both as logged curves on one fixed axis in a trend view. A real-time curve is lost on restart; a logged curve is read back from the storage card.
- Log engineering values from DB_IO, never raw analog counts.
- Log at the rate the process changes – 10 s for an oven – not at the fastest rate the panel allows.
- Plot the setpoint on the same axis as the process value; the gap is the information.
Real-Time Trends Versus Logged Trends
A Comfort panel can draw two kinds of curve, and choosing the wrong one is a common first mistake. A real-time curve reads the tag directly; its history exists only in panel memory and is lost when runtime restarts. A logged curve reads from a data log on the panel's storage card; it survives a restart, can be scrolled back over hours or days and exported to Excel. Use real-time curves on commissioning screens, logged curves for anything an operator or supervisor may want to look back at. The simulator in Stage 6 lets you restart runtime and see the difference.
Lab Flow: From the Transmitter to a Tested Trend Screen
This lesson is part of the Softwell HMI lab manual series and follows the same six stages as every other lesson, using the IO mapping structure from HMI alarm configuration.
Stage 1Field Wiring and PLC Tag Table
A two-wire 4–20 mA temperature transmitter TT101 (0 – 200 °C) is wired to channel 0 of an analog input module set to current, 4–20 mA with wire-break diagnostics enabled. The oven door switch is wired NC (1 = closed) and the heater contactor K10 is driven from a digital output. The analog start address is assigned in device configuration; this lesson uses %IW96.
| PLC tag | Address | Type | Device / comment |
|---|---|---|---|
TT101_Raw | %IW96 | Int | Oven temperature transmitter, 4–20 mA = 0 – 27648 |
B20_DoorClosed | %I4.2 | Bool | Door switch, NC, 1 = closed |
K10_Heater | %Q1.4 | Bool | Heater contactor coil |
Stage 2Input Mapping: Scaling into DB_IO
Add two members to DB_IO – TT101_Temp (Real, °C) and TT101_Fault (Bool) – and scale once, in FC_InputMapping. From here on, every block and the HMI use the engineering value. Scaling details are in PLC analog input scaling in TIA Portal.
// FC_InputMapping – analog channel TT101 (SCL network)
"DB_IO".TT101_Temp := SCALE_X(MIN := 0.0,
VALUE := NORM_X(MIN := 0, VALUE := "TT101_Raw", MAX := 27648),
MAX := 200.0);
"DB_IO".TT101_Fault := "TT101_Raw" > 32511; // overflow / wire break reads 32767
"DB_IO".B20_DoorClosed := "B20_DoorClosed";
Stage 3Logic: FC_OvenControl
Create DB_Oven with SP (Real), Hyst (Real, 2.0), Heater_Cmd (Bool) and HighAlarm (Bool). The control is a simple two-position controller with hysteresis; for continuous control see PID_Compact in TIA Portal.
// FC_OvenControl – called after FC_InputMapping
IF "DB_Oven".SP > 180.0 THEN "DB_Oven".SP := 180.0; END_IF; // PLC repeats the HMI limits
IF "DB_Oven".SP < 20.0 THEN "DB_Oven".SP := 20.0; END_IF;
IF NOT "DB_IO".B20_DoorClosed OR "DB_IO".TT101_Fault THEN
"DB_Oven".Heater_Cmd := FALSE; // interlocks first
ELSIF "DB_IO".TT101_Temp < "DB_Oven".SP - "DB_Oven".Hyst THEN
"DB_Oven".Heater_Cmd := TRUE;
ELSIF "DB_IO".TT101_Temp >= "DB_Oven".SP THEN
"DB_Oven".Heater_Cmd := FALSE;
END_IF;
"DB_Oven".HighAlarm := "DB_IO".TT101_Temp > "DB_Oven".SP + 10.0;
// FC_OutputMapping
"K10_Heater" := "DB_Oven".Heater_Cmd;
Stage 4HMI Tags and the Data Log
Drag DB_IO and DB_Oven into an HMI tag table. Then open Historical data → Data logs and create DL_Oven.
| Data log property | Setting | Why |
|---|---|---|
| Number of entries | 5,000 | Two tags every 10 s ≈ 7 hours; size it from cycle × tags × period |
| Storage location | SD card, e.g. \Storage Card SD\Logs | Industrial media rated for continuous writing |
| File format | CSV | Opens directly in Excel |
| Logging method | Circular | Continuous process; oldest entries overwritten |
| Enable logging at runtime start | Yes | Never miss data after a power cycle |
| HMI tag | Type | PLC member | Logging |
|---|---|---|---|
DB_IO_TT101_Temp | Real | "DB_IO".TT101_Temp | DL_Oven, cyclic 10 s |
DB_Oven_SP | Real | "DB_Oven".SP | DL_Oven, cyclic 10 s; limits 20 – 180 |
DB_Oven_Heater_Cmd | Bool | "DB_Oven".Heater_Cmd | – |
DB_IO_TT101_Fault, DB_Oven_HighAlarm | Bool | DB members | Discrete alarms |
DB_IO_B20_DoorClosed | Bool | "DB_IO".B20_DoorClosed | – |
| Process | Typical logging cycle | Reason |
|---|---|---|
| Oven or furnace temperature | 10 – 30 s | Thermal mass changes slowly |
| Tank level | 5 – 10 s | Fill and empty rates are gradual |
| Line pressure | 1 – 2 s | Faster transients matter |
| Motor current during start | 200 – 500 ms | The start peak lasts only seconds |
| Production counters | On change or per shift | Values step rather than drift – see the shift report lesson |
Stage 5Link HMI Tags to the Trend View and Graphics
| # | Object | Properties | Tag / event |
|---|---|---|---|
| ① | Trend view TV_Oven, 560 × 248 px | Curve 1 PV: source logged values, solid navy, 3 px. Curve 2 SP: logged, grey dashed. Value axis fixed 0 – 200 °C; time axis 1 h | DL_Oven: DB_IO_TT101_Temp, DB_Oven_SP |
| ② | Ruler | Enabled in the trend view; shows exact values at the cursor | – |
| ③ | Trend toolbar | Scroll back/forward, zoom, ruler, start/stop | Built-in buttons |
| ④ | Output field PV | Format 999.9 °C; appearance animation: border red when the alarm is active | DB_IO_TT101_Temp, DB_Oven_HighAlarm |
| ⑤ | I/O field SP | Mode Input, limits 20 – 180, authorisation Operator | DB_Oven_SP |
| ⑥ | Rectangle + text Heater | Appearance: 1 → dark fill, text ON; 0 → white, OFF | DB_Oven_Heater_Cmd |
| ⑦ | Symbolic output field Door | Text list Open / Closed | DB_IO_B20_DoorClosed |
Keep curve colours and line styles identical on every trend screen of the project, and follow the grey-when-normal rules from HMI screen design best practices. For plant-wide archives the same principles scale up to SCADA trend configuration.
Stage 6Perform and Test: Animated Oven Trend Screen
This simulator runs the same chain as the lab: a 4–20 mA temperature signal is scaled in FC_InputMapping, FC_OvenControl switches the heater with hysteresis, and the panel logs PV and SP every 10 s into DL_Oven and draws them in the trend view. Time runs 50× faster than real time. Change the setpoint, open the door, break the sensor wire, then restart the HMI runtime and compare a real-time curve with a logged curve.
| Time (sim) | TT101_Temp | SP |
|---|
Troubleshooting Trends and Logs
| Symptom | Likely cause | First check |
|---|---|---|
| Curve is a flat line at 0 | Curve linked to the raw tag or the PLC is not running | Curve source tag and DB_IO_TT101_Temp in a watch table |
| History empty after restart | Curve uses real-time source | Change curve source to logged values |
| Gaps in the logged curve | Logging stopped or storage full | Data log fill level, storage card, circular setting |
| Values 0 – 27648 in the CSV | Raw tag logged instead of DB_IO value | Log DB_IO_TT101_Temp, scale in the PLC |
| Panel slow | Too many logged tags or too short cycle | Reduce tags, lengthen cycle |
Hands-On Lab: Oven Temperature from Transmitter to Trend View
Hands-on- TIA Portal with WinCC Comfort and a panel or PLCSIM + HMI simulation
- An analog input module or a simulated value for TT101_Raw
- An SD card or simulated storage path
- Estimated time: 75 minutes
Wire the transmitter and map the PLC tags
Wire TT101 (4–20 mA) to AI channel 0, the door switch to %I4.2 and the heater contactor to %Q1.4, and declare TT101_Raw, B20_DoorClosed and K10_Heater in the PLC tag table.
Scale into DB_IO in FC_InputMapping
Convert TT101_Raw with NORM_X and SCALE_X to TT101_Temp in °C and set TT101_Fault on a wire break.
Write FC_OvenControl
Switch the heater with 2 °C hysteresis around the setpoint, block it when the door is open or the sensor is faulty, and clamp the setpoint to 20 – 180 °C.
Create HMI tags and the data log
Drag DB_IO and DB_Oven into the HMI tag table, create DL_Oven (circular, CSV, 5,000 entries) and log PV and SP cyclically every 10 s.
Link the trend view and fields
Add the trend view with logged PV and SP curves on a fixed 0 – 200 °C axis, the setpoint I/O field with limits, the PV field and the heater lamp.
Perform and test
Change the setpoint, open the door, simulate a wire break and restart runtime; confirm the logged history survives and the CSV opens in Excel.
The engineering value comes from DB_IO, the heater obeys its hysteresis and interlocks, PV and SP are logged every 10 s, and the trend shows the last hour even after runtime has restarted.
Frequently asked questions
What is the difference between a real-time and a logged trend?
A real-time trend plots the tag as it changes and keeps no permanent record. A logged trend reads from a data log stored on the panel media and survives a runtime restart.
Circular or segmented logging, which should I use?
Circular suits continuous monitoring where only recent history matters. Segmented creates a new file when the log fills, which suits batch records that must be archived separately.
How fast should I log a temperature?
Usually every ten to thirty seconds. Thermal processes change slowly, and faster logging produces large files without adding information.
Why has my panel become slow after adding logging?
Too many tags at too fast a cycle, or unsuitable storage media. Reduce the number of logged tags, lengthen the acquisition cycle and use industrial-grade storage rated for continuous writing.
Should I scale the analog value in the PLC or on the HMI?
In the PLC, in the input mapping FC. The HMI, the data log, SCADA and reports then all use the same engineering value, and a raw-count archive never has to be converted afterwards.
How do I detect a broken 4–20 mA wire?
With channel diagnostics enabled, the analog card reports 32767 on a wire break. Check for values above the over-range limit in the input mapping FC and publish a fault bit that blocks the control output and raises an alarm.