Overview
Comfort Panels (TP, KTP, KP, and MTP series) running WinCC Comfort or WinCC Advanced within TIA Portal can automatically load recipe data records at panel boot so that connected PLC tags reflect the correct process parameters before the operator screen appears. Because Comfort Panels do not expose a native "On Panel Start" system event the way some PLCs expose "On First Scan," the load action must be attached to a single-fire event such as the Activate event of a dedicated Start Screen, or driven by a one-shot trigger tag that a global VBScript observes exactly once.
This guide consolidates the two field-proven approaches (Start Screen activate event + System Function, and Trigger Tag value-change event + Script) and shows the equivalent VBScript calls for engineers who prefer code over the function table. It also documents the recipe data flow, the storage locations that WinCC supports, the synchronization modes between PLC and panel, and a verification checklist that catches the most common boot-time recipe faults before the panel is shipped to production.
Prerequisites
- TIA Portal V15.1 or later (V16, V17, V18, V19, V20 all behave identically for this workflow). Unified Comfort Panels require TIA V17 + HSP or later.
- Configured HMI connection between the Comfort Panel and the S7-1200, S7-1500, ET 200SP, or S7-300/400 PLC over PROFINET or PROFIBUS.
- Recipe definition created under HMI > Recipes > [Recipe name] with at least one data record element bound to a PLC tag.
- At least one stored data record in the panel's internal flash, USB stick, SD card, or network path.
- Panel runtime authorization (license) for recipes - included by default on Comfort and Unified Comfort Panels, but verify in Runtime Settings > Licensing.
Recipe Architecture in WinCC Comfort/Advanced
WinCC Comfort distinguishes between three logical layers that every startup load must reconcile:
- Recipe definition - the symbolic container with element names, data types, and tag pointers. Compiled into the panel runtime.
- Data records - the actual value sets. Stored on the panel file system (\Storage Card SD\Recipes, \USB\Recipes, or the internal flash \Recipes).
- PLC tags - the runtime variables in the controller. A load operation copies the data record values into these tags.
When the panel boots, the runtime loads the project configuration but does not automatically push any data record to the PLC. The default behavior is to leave PLC tags at their last PLC-side value (or zero on a cold start of both PLC and panel). To force a load at startup you must trigger the LoadDataRecord (older TIA: LoadRecipe) system function - or call its VBScript equivalent HmiRuntime.ActiveRecipe / HmiRuntime.Recipes("Recipe_1").LoadDataRecord(1, 0) - exactly once per boot.
Method 1 - Start Screen with the Activate Event
This is the cleanest no-script solution and uses only configuration tables. The idea is to create a dedicated Start Screen whose Activate event runs exactly once when the runtime boots, executes the load function, and then activates the operator's normal Start Screen.
- In the project tree, right-click Screens and select Add new screen. Rename it
Screen_Startup. Set it as the Start screen under Runtime Settings > General > Start screen. - Open Screen_Startup and switch to the Events tab. On the Activate event, configure two system functions in this order:
- LoadDataRecord (recipe: your recipe name; data record number: 1; synchronization mode: 0 = load only if record exists)
-
ActivateScreen (screen name: your original operator Start Screen, e.g.
Screen_Process)
- If the TIA Portal version exposes only ActivateCleanScreen in the function browser for a Comfort Panel, the panel is in a mode where the previous screen is not held in memory. Use ActivateCleanScreen instead - it performs the same navigation but releases the startup screen, freeing its memory footprint.
- Compile the HMI project and download to the panel. Power-cycle the panel and observe the boot sequence:
Screen_Startupshould appear for < 200 ms, the load executes, andScreen_Processbecomes active.
Screen_Startup is replaced by Screen_Process and the operator cannot navigate back to it (no button points to it), the event is single-fire for the panel's lifetime.
Method 2 - Trigger Tag with Value-Change Event
When the Start Screen approach is impractical - for example, the project uses a hard-coded start screen referenced by other automation logic - drive the load from a single-shot trigger tag.
- Create an internal HMI tag, e.g.
BootTriggerof type Int with a start value of1. - Open any always-active scheduler or use the Once a day / Change scheduler to write a unique value to
BootTriggerat runtime start. A clean approach is to use a global VBScript that runs at runtime start; see Method 3. - On the tag's Value change event, call LoadDataRecord (recipe name, record number, sync mode).
- After the load, the script can reset
BootTriggerto a sentinel value so the value-change event will not refire on every cyclic write.
This method is the recommended fallback when the Activate event of the Start Screen cannot be used because the screen is used for other purposes later in the runtime.
Method 3 - VBScript with Screen Number Tag
For engineers who prefer a single code block that handles navigation, loading, and logging, VBScript on a global trigger tag is the most flexible approach.
- Create an HMI tag
BootStep(Int) with initial value0. - In Project tree > Scripts > Global area create a new VBScript function, e.g.
Boot_LoadRecipe. - On the Value change event of
BootStep, add a system function to run this script.
Example script body (TIA Portal V17 / V18 syntax):
' Boot_LoadRecipe - runs once per panel boot
Sub Boot_LoadRecipe()
Dim recipeName, recordNum, syncMode
recipeName = "Recipe_Process"
recordNum = 1
syncMode = 0 ' 0 = load, 1 = synchronize (PLC wins), 2 = overwrite (record wins)
On Error Resume Next
HmiRuntime.ActiveRecipe = recipeName
HmiRuntime.Recipes(recipeName).LoadDataRecord recordNum, syncMode
If Err.Number <> 0 Then
HmiRuntime.Trace "Boot load failed: " & Err.Description & vbCrLf
Else
HmiRuntime.Trace "Boot load OK: " & recipeName & " record " & recordNum & vbCrLf
End If
On Error Goto 0
HmiRuntime.Screens("Screen_Process").Activate
HmiRuntime.Tags("BootStep").Write 9999 ' sentinel - prevents re-trigger
End Sub
To call the script at panel start without a manual action, set BootStep to a non-sentinel value (for example 1) from a project-wide Initialize event: open the project tree root > Events > Runtime started and configure Set tag to write 1 into BootStep. The runtime-start event is available in TIA Portal V17 and later on Comfort Panels and is the closest equivalent to a true "On Panel Start" event.
System Function and VBScript Reference
| Action | System Function (table config) | VBScript call | Notes |
|---|---|---|---|
| Load data record to PLC | LoadDataRecord | Recipes(name).LoadDataRecord n, mode | mode 0/1/2 = load / synchronize / overwrite |
| Save current PLC values as record | SaveDataRecord | Recipes(name).SaveDataRecord n | Writes to configured storage path |
| Export record to CSV | ExportDataRecord | Recipes(name).ExportDataRecord n, path | Path = USB\export.csv etc. |
| Import record from CSV | ImportDataRecord | Recipes(name).ImportDataRecord path | Overwrites the named record |
| Delete record from storage | DeleteDataRecord | Recipes(name).DeleteDataRecord n | Removes file from disk |
| Get current loaded record number | GetDataRecordName / GetDataRecordNumber | Recipes(name).RecordNumber | Returns 0 if none |
| Navigate to operator screen | ActivateScreen / ActivateCleanScreen | Screens(name).Activate | ActivateCleanScreen releases prior screen |
Recipe Storage Paths on a Comfort Panel
| Storage | Runtime Path | Persistent Across Power-Cycle? | Typical Use |
|---|---|---|---|
| Internal flash | \Recipes | Yes | Default location; survives firmware download unless full reset |
| SD card (storage card slot) | \Storage Card SD\Recipes | Yes (card-dependent) | Hot-swap recipes without PC; large libraries |
| USB stick (front port) | \USB\Recipes | No (depends on stick presence) | Manual recipe import from operator USB |
| Network share | \\server\share\Recipes | Yes | Centralized recipe management across many panels |
The path is configured under Recipe > Properties > Storage paths. When the panel boots without the SD card or USB stick, LoadDataRecord will return an error code - see the verification section for which tag to read to detect this.
PLC-Side Handshake (Recommended for Robust Loads)
To confirm the panel has actually pushed the values to the PLC, build a small handshake:
- Define an HMI tag
HMI_RecipeLoaded(Bool) bound to a PLC tag in DB100 (e.g.DB100.DBX0.0). - Define an HMI tag
PLC_RecipeAck(Bool) bound toDB100.DBX0.1. - On the panel's Start Screen Activate event, configure: LoadDataRecord, Set tag (HMI_RecipeLoaded = 1), ActivateScreen.
- In the PLC OB1 or OB100, monitor
HMI_RecipeLoaded. When it goes high, latch a "Recipe values valid" bit for downstream logic and writePLC_RecipeAck= 1. - On the panel's PLC_RecipeAck value-change event, reset
HMI_RecipeLoadedto 0 so the load will refire correctly on the next boot.
This handshake prevents the classic failure mode where the panel reports success but the PLC tag was overwritten by an OB100 initialization a few milliseconds later.
Verification Checklist
- Boot trace - Enable Runtime Settings > Services > Trace with output to a file. The "Boot load OK: ..." trace line should appear once per power-cycle.
- Tag inspector - Open Online > Tag monitor on the panel and the PLC. After boot, the PLC tags must equal the loaded data record's values, not zero and not the last PLC-side value.
- Re-trigger test - Power-cycle the panel three times. Confirm the load fires only once per cycle by checking the trace log count.
- Storage presence - With the SD card removed, verify the load still succeeds from internal flash. With the SD card present and the storage path set to it, verify the SD card version loads.
- License check - In Runtime Settings > Licensing confirm the Recipes option is licensed; otherwise LoadDataRecord silently returns error 0x8004xxxx.
- Single-fire check - Navigate operator screens, return to Start Screen, and confirm the Activate event does not refire. If it does, the Start Screen is reachable by user navigation; replace it with a screen whose name is hidden from the navigation tree.
Troubleshooting Matrix
| Symptom | Likely Cause | Fix |
|---|---|---|
| Load never fires at boot | Start Screen Activate event is configured but Start Screen is not set as runtime start screen | Set Runtime Settings > General > Start screen = Screen_Startup |
| Load fires repeatedly | Trigger tag cycles a non-sentinel value | Write a sentinel value (e.g. 9999) after load; verify with trace |
| ActivateScreen unavailable in function browser | Panel runs in CleanScreen mode or screen name invalid | Use ActivateCleanScreen; verify the target screen exists and is compiled |
| PLC tags still zero after boot | Recipe storage path points to missing SD/USB or empty folder | Set storage path to internal flash; confirm data record file exists |
| PLC tags loaded, then overwritten in <100 ms | OB100 / startup OB initializes those tags | Skip tag init in startup OB when HMI_RecipeLoaded = 1, or initialize after the handshake |
| Error code 0x80040001 on LoadDataRecord | Recipe name or data record number invalid | Confirm recipe name spelling matches the project tree; check record number ≥ 1 |
| Error code 0x80040010 on LoadDataRecord | Storage medium not available | Insert SD/USB, or switch storage path to internal flash |
| Load succeeds in simulator, fails on panel | PLC connection not yet established when Activate event fires | Add a 500 ms delay (scheduler once-a-day delay or VBScript Sleep) before LoadDataRecord |
| Multiple panels overwrite each other's recipes | Network share storage path used without per-panel subfolder | Configure per-panel folder in Storage paths > Network |
Migration Notes Between TIA Portal Versions
Recipes were reworked across TIA Portal major releases. On projects migrated from V13/V14, the legacy function names LoadRecipe / SaveRecipe appear in the function browser but are internally aliased to LoadDataRecord / SaveDataRecord. The VBScript object model also changed: in V13, the recipe was reached via HMIRuntime.ActiveScreen.ScreenItems("...") in some configurations, while V17 onward uses HmiRuntime.Recipes("...").LoadDataRecord n, mode. When porting older scripts, verify both the object path and the parameter order - the legacy two-parameter signature (n) still works, but the three-parameter signature (n, mode) is required when you need explicit synchronization control.
Related WinCC Comfort Functions Worth Knowing
- SetRecipeValue / GetRecipeValue - read or write a single element of the active record without a full load, useful for boot-time patching.
- ReadUserArchive - for larger structured datasets beyond recipes (separate licensing).
- SetConnectionMode - force the HMI connection online before the load runs, eliminating the "connection not yet established" race.
- SimulateTag - in the simulator, simulate recipe tags offline without a real PLC for HMI FAT testing.
For deeper coverage, refer to the TIA Portal Help Portal entries on WinCC Comfort - Working with Recipes and the S7-1200 / S7-1500 communication manuals. The Siemens Industry Online Support (SIOS) entry "Comfort Panel - Loading recipes automatically" is the canonical KB for this workflow.
FAQ
What is the difference between ActivateScreen and ActivateCleanScreen on a Comfort Panel?
ActivateScreen keeps the previous screen in runtime memory so the user can return to it with the system "back" key. ActivateCleanScreen releases that memory and is used when the previous screen is a one-shot like a Start Screen that should never be revisited; both perform the same navigation forward.
Why does LoadDataRecord fire only once on Start Screen Activate even though the operator never navigates away?
Because ActivateScreen is called immediately after the load in the same event, the startup screen is replaced. The next Activate event on the new (operator) screen is a different event instance. As long as no user action returns to the startup screen, the event will not refire for the lifetime of the runtime.
Can I trigger a recipe load from the PLC instead of the panel?
Yes. Set a PLC tag the panel polls, configure a value-change event on the panel side that calls LoadDataRecord, and let the PLC write that tag at the appropriate moment. This is the standard "PLC-master, HMI-slave" pattern when the controller owns the boot sequence.
Which Comfort Panels support recipes and automatic load at startup?
All 4th-generation Comfort Panels (KTP400 to TP2200) and Unified Comfort Panels (MTP700 to MTP2200) support recipes natively with the WinCC Comfort / Advanced runtime. Basic Panels (KTP400 Basic, KTP700 Basic, etc.) do not support recipes.
What is the correct synchronization mode for a cold-boot load?
Use mode 0 (load only) for the boot sequence. Modes 1 (synchronize - PLC wins on conflict) and 2 (overwrite - record wins) are intended for operator-triggered loads after the system is already running and should not be used at startup because the PLC values may not yet be valid.