HMI Engineering · Lab Manual

HMI Trends and Data Logs in TIA Portal: Lab Manual from 4–20 mA Sensor to Trend View

A trend turns a number into a story. Follow one temperature signal through all six stages of the Softwell lab manual: 4–20 mA wiring and PLC tags, scaling in the input mapping FC, oven control logic, HMI tags and a data log, the trend view, and a live simulator that shows why logged curves survive a restart.

2,500+ engineers trained 4.9/5 Google rating 21+ years, Chinchwad, Pune Next batch: contact for dates
Quick answer

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.

Lab manual flow: field input to tested HMI screenSix stages: field device and PLC tag, input mapping to DB_IO, PLC logic, HMI tags, graphics linking, and perform and test.1Field + tags%IW96 TT101_Raw4–20 mA, door, heater2Input mappingNORM_X / SCALE_X→ DB_IO.TT101_Temp3LogicFC_OvenControlhysteresis, interlocks4HMI tagsDB_IO_TT101_Temp+ data log DL_Oven5GraphicsTrend viewPV + SP, ruler6Perform + testSimulatordoor, wire breakAddress rule for every lesson: %I only in FC_InputMapping, %Q only in FC_OutputMapping, symbolic DB members everywhere else – including the HMI.
Figure 1 – Six-stage lab flow for the oven temperature trend.

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 tagAddressTypeDevice / comment
TT101_Raw%IW96IntOven temperature transmitter, 4–20 mA = 0 – 27648
B20_DoorClosed%I4.2BoolDoor switch, NC, 1 = closed
K10_Heater%Q1.4BoolHeater 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 propertySettingWhy
Number of entries5,000Two tags every 10 s ≈ 7 hours; size it from cycle × tags × period
Storage locationSD card, e.g. \Storage Card SD\LogsIndustrial media rated for continuous writing
File formatCSVOpens directly in Excel
Logging methodCircularContinuous process; oldest entries overwritten
Enable logging at runtime startYesNever miss data after a power cycle
HMI tagTypePLC memberLogging
DB_IO_TT101_TempReal"DB_IO".TT101_TempDL_Oven, cyclic 10 s
DB_Oven_SPReal"DB_Oven".SPDL_Oven, cyclic 10 s; limits 20 – 180
DB_Oven_Heater_CmdBool"DB_Oven".Heater_Cmd–
DB_IO_TT101_Fault, DB_Oven_HighAlarmBoolDB membersDiscrete alarms
DB_IO_B20_DoorClosedBool"DB_IO".B20_DoorClosed–
ProcessTypical logging cycleReason
Oven or furnace temperature10 – 30 sThermal mass changes slowly
Tank level5 – 10 sFill and empty rates are gradual
Line pressure1 – 2 sFaster transients matter
Motor current during start200 – 500 msThe start peak lasts only seconds
Production countersOn change or per shiftValues step rather than drift – see the shift report lesson

Stage 5Link HMI Tags to the Trend View and Graphics

Oven trend screen layout on an 800 by 480 panelTrend view with process value and setpoint curves, ruler and toolbar on the left, and a side panel with process value, setpoint input field, heater lamp and door status on the right.Oven 1 · Temperature◀ ▶ zoom ruler start/stop (toolbar)PV TT101150.2 °CSetpoint150.0 °CHeaterONDoorClosed1234567
Figure 2 – Oven trend screen. Numbers match the object table.
#ObjectPropertiesTag / event
①Trend view TV_Oven, 560 × 248 pxCurve 1 PV: source logged values, solid navy, 3 px. Curve 2 SP: logged, grey dashed. Value axis fixed 0 – 200 °C; time axis 1 hDL_Oven: DB_IO_TT101_Temp, DB_Oven_SP
②RulerEnabled in the trend view; shows exact values at the cursor–
③Trend toolbarScroll back/forward, zoom, ruler, start/stopBuilt-in buttons
④Output field PVFormat 999.9 °C; appearance animation: border red when the alarm is activeDB_IO_TT101_Temp, DB_Oven_HighAlarm
⑤I/O field SPMode Input, limits 20 – 180, authorisation OperatorDB_Oven_SP
⑥Rectangle + text HeaterAppearance: 1 → dark fill, text ON; 0 → white, OFFDB_Oven_Heater_Cmd
⑦Symbolic output field DoorText list Open / ClosedDB_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.

Field and PLC
HMI · Oven trend screen
Oven 1 · TemperatureNo active alarms
Ruler
PVSPHeaterOFF
Time (sim)TT101_TempSP
The oven heats from 25 °C towards the 150 °C setpoint. Watch the heater switch at SP − 2 °C and SP.

Troubleshooting Trends and Logs

SymptomLikely causeFirst check
Curve is a flat line at 0Curve linked to the raw tag or the PLC is not runningCurve source tag and DB_IO_TT101_Temp in a watch table
History empty after restartCurve uses real-time sourceChange curve source to logged values
Gaps in the logged curveLogging stopped or storage fullData log fill level, storage card, circular setting
Values 0 – 27648 in the CSVRaw tag logged instead of DB_IO valueLog DB_IO_TT101_Temp, scale in the PLC
Panel slowToo many logged tags or too short cycleReduce tags, lengthen cycle

Hands-On Lab: Oven Temperature from Transmitter to Trend View

Hands-on
Before you start
  • 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
1

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.

Monitoring the tag table shows a raw value of about 0 – 27648 as the transmitter moves from 4 to 20 mA.
2

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.

TT101_Temp reads in °C and TT101_Fault goes to 1 when the wire is disconnected.
3

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.

The heater switches ON at SP − 2 °C and OFF at SP, and never runs with the door open.
4

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.

DL_Oven appears under Historical data and both tags show it in their logging properties.
5

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.

Both curves share one fixed axis and the ruler shows exact values.
6

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.

After a runtime restart the logged curve still shows the last hour; the CSV contains time, PV and SP columns.
Checkpoint—how to know you did it right

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.

Reviewed by Bhawesh Kumar SinghIndustrial Automation Trainer and Industry 4.0 Consultant · Softwell Automation · 21+ years industry experience

Get the full syllabus + free demo class

Share your details—a Softwell training advisor will contact you with batch dates, fees and hardware-practice options.

No spam. Used only to share course details for this enquiry.

Learn with practical industrial examples

Join live online, Pune classroom or corporate in-plant automation training.

Request Course Details
Verified learning pathway

Discuss HMI Trends and Data Logs

Explore practical curriculum, software, hardware and batch options for this technology.

Content reviewed: 16 October 2026

Siemens PLC & TIA Portal Learning Path

Continue with the related Siemens PLC tutorials in this practical learning series.

  1. SCL vs Ladder Logic
  2. Upload PLC Program
  3. TIA Selection Tool
  4. Analog Input Scaling
  5. PLC Counters
  6. PLC Timers
  7. Addressing & Data Types
  8. Hardware & PLC Tags
  9. OB, FB, FC & DB
☎ Call WhatsApp ✉ Email Enquire Now