Overview
Engineers frequently need an HMI screen that reflects a variable number of statuses stored in a PLC array — for example status[x,y,z] driving dozens of indicator circles whose visibility, label, and color all change with the data. The first reaction is to ask for a runtime "create object" script. On a Siemens KTP700 Basic Panel that is impossible: the runtime contains no script host. This reference documents the actual capabilities of TIA Portal V16 across Basic Panels, Comfort Panels, and WinCC RT, and gives five concrete methods that cover the same use case — pre-allocated animated objects, array multiplexing, faceplates, runtime VBScript on supported targets, and TIA Portal Openness for engineering-time generation. Siemens documents the Openness workflow in the official application example 108716692 and the VBScript manual under 53752382.
KTP700 vs Comfort Panel: Scripting Capability
Siemens SIMATIC HMI panels divide into three runtime classes, and only two of them expose a script engine.
| Runtime class | Example panels | VBScript host | Project functions | Engineering-time automation |
|---|---|---|---|---|
| Basic Panels | KTP400 Basic, KTP700 Basic, KTP900 Basic, KTP1200 Basic | No | No | Openness only |
| Comfort Panels | TP700 Comfort, TP900 Comfort, TP1200 Comfort, TP1500 Comfort, TP1900 Comfort, TP2200 Comfort | Yes (global area) | Yes | Openness only |
| WinCC RT Advanced / Professional | PC-based runtime | Yes (C and VBScript) | Yes | Openness only |
The KTP700 Basic is a member of the Basic Panel family. Its runtime image (firmware in the V16 line, e.g. V16.0.x.x) contains no VBScript host, no scheduled tasks, and no project functions. Inspecting the device in the TIA Portal project tree confirms the absence of a Scripts node. Any "Scripts" entry shown in the IDE disappears the moment the device target is switched from a Comfort Panel to a KTP Basic.
Prerequisites
- TIA Portal V16 Update 4 or later installed on the engineering workstation.
- WinCC Comfort V16 or higher for authoring scripts on Comfort Panels and WinCC RT Advanced.
- STEP 7 V16 (S7-1500 / S7-1200) for the PLC tag interface and DB structure backing the HMI tag array.
- Target device firmware compatible with TIA V16 (KTP700 Basic ≥ V16.0.0.0; Comfort Panels ≥ V16.0.0.0).
- For TIA Portal Openness: TIA Portal V16 Professional plus the Openness redistributable described in the Siemens application example 108716692.
PLC-Side Array Preparation
The HMI runtime never owns the source of truth. The array that drives the visibility animation is computed in the PLC and exposed to the HMI. The following SCL excerpt (TIA V16, S7-1500) shows the typical pattern: pack a 3-D status array into a 1-D BOOL array sized to the maximum number of HMI objects.
// dbStatus
// status[0..7, 0..7, 0..1] : BOOL // 8 x 8 x 2 = 128 bits
// statusFlat[0..127] : BOOL // mirror consumed by the HMI
DATA_BLOCK "dbStatus"
STRUCT
status : ARRAY[0..7, 0..7, 0..1] OF BOOL;
statusFlat : ARRAY[0..127] OF BOOL;
END_STRUCT;
END_DATA_BLOCK
FUNCTION "PckStatusToFlat" : Void
VAR
i, j, k, idx : INT;
END_VAR
BEGIN
FOR i := 0 TO 7 DO
FOR j := 0 TO 7 DO
FOR k := 0 TO 1 DO
idx := i * 16 + j * 2 + k;
"dbStatus".statusFlat[idx] := "dbStatus".status[i, j, k];
END_FOR;
END_FOR;
END_FOR;
END_FUNCTION
Map "dbStatus".statusFlat[0..127] to an HMI tag array of the same length. The KTP700 Basic driver polls contiguous bits without conversion overhead; the Comfort Panel driver does the same. Keep the HMI array length strictly equal to the PLC array length to avoid Quality BAD on out-of-range indices.
Method 1 — Pre-Allocate Objects with Visibility Animation
This is the most portable approach for the KTP700 Basic. Place the maximum number of objects (for example 8 × 8 = 64 circles) on the screen at fixed pixel coordinates, then animate the Visibility property of each via one element of the bit array.
- Open the target screen in WinCC and lay out the maximum number of circles. Name them predictably:
Circle_0,Circle_1, …,Circle_63. Names matter because VBScript and HMI tag references resolve by name. - Select the first object and open Properties > Animations > Visibility. Bind visibility to a tag expression of type
StatusFlat[0]. Use the convention "0 = invisible, 1 = visible". - Repeat the binding for every object, incrementing the array index by one. Group selection + paste speeds up the operation.
- Compile the project. The compiler warns when the number of animated screen items on a single screen approaches the device limit (refer to the panel's manual for the exact number — Basic Panels allow fewer animated items per screen than Comfort Panels).
Use the Appearance animation in parallel to switch color and the Label animation to switch text, both bound to the same array index. The runtime cost of these animations is small on both Basic and Comfort targets, but be conservative: animations are evaluated every cycle the panel is repainted.
Method 2 — Symbolic Array Multiplexing
Multiplexing re-binds one object's tag references at runtime to a tag selected by an index. The technique is the closest you get to "dynamic" objects on a fixed screen. On Comfort Panels the Multiplex column in the tag editor accepts an expression such as "Value " + INT_TO_STRING(IndexTag) for text, or an indirect analog multiplex for color.
| Property | Multiplex expression (Comfort / RT) | Notes |
|---|---|---|
| Label (text) | "State " + INT_TO_STRING(IndexTag) |
Use a Text list indexed by a tag whose value is IndexTag. |
| Background color | Indirect analog multiplex on StatusWord[IndexTag] with a color list |
Map analog value range to the color list in the HMI tag properties. |
| Process value | MeasValue[IndexTag] |
PLC must store the same array length that the HMI tag array exposes. |
The Basic Panel runtime supports indirect addressing on tags, but it does not support tag-prefix multiplexing in animations as deeply as Comfort. When the design exceeds the Basic Panel multiplexing limits, upgrade the target to a TP700 Comfort or move the visualization to WinCC RT Advanced / Professional.
Method 3 — Faceplates for Reusable Object Templates
Comfort Panels and WinCC RT support faceplates: parameterised screen objects that are instantiated many times with a property tag pointing to a DB. A faceplate for an indicator circle contains the circle graphic, a label, and visibility logic; the instance tag carries the array index.
- Create a faceplate
fpStatusIndicatorin the project library of TIA Portal V16. - Add interface tags
IndexIn(INT) andVisibilityIn(BOOL). The interface defines what each instance must pass to the template. - Inside the faceplate, bind the circle visibility to
VisibilityInand the label to a text list keyed offIndexIn. - On the target screen, drag the faceplate into position. Assign each instance a distinct
IndexIntied to the flattened status array element. - Use a faceplate container to switch the active instance through a single button click — the runtime redraws only the body of the faceplate, not the surrounding screen.
Faceplates reduce project size and compile time compared to 64 individual objects with 64 separate visibility animations. On Comfort Panels, the maximum number of faceplate instances per screen depends on the panel's resources; check the device manual for current values and observe the compile output for warnings.
Method 4 — VBScript in WinCC Comfort / Professional
When the target is a Comfort Panel or a WinCC RT Advanced / Professional PC runtime, project-level VBScripts are available. VBScripts on these targets do not create new runtime objects — the screen item set is fixed at compile time. They reconfigure properties of objects that already exist on a screen. The two most common helpers are HMIRuntime.Screens and SmartTags.
' --- ModGlobalScript.vbs ---
' Configures a single indicator at runtime. Index is 0..N-1.
Sub ConfigureIndicator(index, visibleFlag, labelText)
Dim scr, obj
Set scr = HMIRuntime.Screens("MainOverview")
Set obj = scr.Items("Indicator_" & index)
obj.Visible = visibleFlag
obj.Text = labelText
End Sub
' Driven by a scheduled task every 500 ms. Pulls the latest
' status array and updates all pre-allocated indicators.
Sub SyncIndicators()
Dim i, flag, lbl
For i = 0 To 63
flag = SmartTags("StatusFlat")(i)
lbl = SmartTags("LabelFlat")(i)
ConfigureIndicator i, flag, lbl
Next i
End Sub
Authoring steps on a TP700 Comfort target:
- Open the project and confirm the device target is a Comfort Panel or PC RT — the Scripts node appears only on these targets.
- Create Scripts > VBScripts > ModGlobalScript.vbs and paste the procedure above.
- Reference it from a button event:
ConfigureIndicator 3, 1, "Running". - Add a scheduled task under Schedules that calls
SyncIndicatorsevery 500 ms. - Compile and download the project. TIA Portal V16 embeds the script in the runtime image for Comfort Panels from firmware V16.0.0.0 onward.
Method 5 — TIA Portal Openness (Engineering-Time Object Generation)
For projects that must truly generate objects without manual editing, the TIA Openness API exposes a C# object model. Openness runs only on the engineering station, never on the HMI runtime. Use it to add an N × N grid of button objects in a loop, set their position via Item.Position, and bind the visibility property to StatusBits[i]. Siemens publishes a worked WinCC example in entry 108716692.
// --- C# snippet: generate 8x8 indicator grid in WinCC ---
using Siemens.Engineering;
using Siemens.Engineering.Hmi;
using Siemens.Engineering.Hmi.Tag;
using Siemens.Engineering.HmiScreen;
HmiTarget target = project.HmiTargets.First(t => t.Name.StartsWith("KTP700"));
Screen screen = target.Screens.Find("MainOverview");
HmiTag visTag = target.Tags.Find("StatusFlat");
for (int y = 0; y < 8; y++)
{
for (int x = 0; x < 8; x++)
{
int idx = y * 8 + x;
var circle = screen.ScreenItems.Add("Circle_" + idx) as CircleItem;
circle.Position = new Position(40 + x * 60, 40 + y * 60);
circle.Size = new Size(50, 50);
circle.Text = idx.ToString();
var vis = new Visibility("Visibility", visTag, idx);
circle.Animations.Add(vis);
}
}
project.Save();
Openness requires TIA Portal V16 Professional with the Openness option installed. The compiled assembly can run headless on a build server with the Openness redistributable described in 108716692. Openness itself cannot be deployed to the panel; the generated HMI project is downloaded like any other.
Script Triggering Options on Comfort Panels
Once VBScripts are available, choose the trigger that fits the data rate and operator expectation.
| Trigger | Use case | Configuration path |
|---|---|---|
| Scheduled task | Poll a status array every 100 – 1000 ms | Schedules > New schedule > Trigger: Cyclic |
| Tag change | React to a single tag transition (e.g. StatusChanged rises) |
Schedules > Trigger: Tag |
| Button event | Operator-triggered recomputation (e.g. "Refresh") | Button Events > Click > VBScript |
| Screen event | Reconfigure indicators when entering a screen | Screen Events > OnLoaded |
Avoid mixing cyclic and tag-change triggers that both write to the same screen items — the last writer wins and the result becomes order-dependent, which complicates commissioning.
Debugging VBScripts in WinCC RT
Comfort Panels and WinCC RT Advanced ship a built-in debugger. Activate it via Project > Runtime settings > Services > Script debugger in the engineering project. The debugger is reachable from the engineering station over Ethernet while the runtime is active. Set breakpoints, single-step, and inspect SmartTags("...") values without modifying the project. Log output via HMIRuntime.Trace writes to the Windows Event Log on the RT Advanced host and to a rotating file under C:\ProgramData\Siemens\Automation\WinCC RT Advanced\Logs. On a Comfort Panel, the trace buffer is exported through ProSave.
Performance and Memory Considerations
Animated objects, faceplates, and VBScript each consume panel resources. Follow these rules of thumb:
- Each animated screen item adds CPU load on every panel cycle. Keep the number of simultaneous animations on a single screen as low as the design allows.
- Faceplate instances share code but each instance allocates memory for the property tags it references. Multiply the per-instance cost by the number of instances to estimate the project footprint.
- VBScript scheduled tasks run on the panel CPU. Polling faster than the HMI update rate (typically 100 ms on Comfort Panels) wastes cycles without visible benefit.
- The Basic Panel flash memory is more limited than Comfort Panel flash. A KTP700 Basic project with 200 animated objects may fail to compile or download — observe the compile output and shrink the design if the warning appears.
Porting from TIA V16 to V17 / V18
The methods above carry forward to TIA Portal V17 and V18 with the following caveats:
- The Openness API surface in V17 added support for the Unified Comfort Panels. Existing V16 code must update its target type and recompile against the V17 Openness DLL.
- VBScript triggers, scheduled tasks, and animations are unchanged across V16 → V18 on the Classic Comfort Panels and WinCC RT Advanced.
- Newer firmware on the KTP700 Basic does not add a script host. Migrating the application to a TP700 Comfort remains the only path to runtime scripting when the panel is fixed.
Verification
- Compile the project in TIA Portal V16 and inspect Compilation > Output for any warning about the number of dynamic items per screen — the warning is the panel-specific limit and must be respected.
- Simulate the runtime with the WinCC RT Advanced simulator. Verify that each indicator's visibility tracks the corresponding
StatusFlatbit and that the label tracks the correspondingLabelFlatentry. - On the physical KTP700, load the project via TIA V16 and exercise the array index PLC logic. Watch the HMI log for entry
Tag StatusFlat[42]: Quality BAD. Quality BAD indicates a DB out-of-range access in the PLC and requires resizing the PLC array to match the HMI tag array length. - If Openness was used, run the assembly on a test TIA Portal workstation against a throwaway project to confirm reproducibility. Diff the generated screen XML against the previous commit to ensure only the expected objects were added.
- For Comfort Panel scripts, attach the script debugger and step through
SyncIndicatorswhile toggling a single bit in the PLC. Confirm the expected screen item is updated.
Troubleshooting Matrix
| Symptom | Cause | Resolution |
|---|---|---|
| No "Scripts" node under KTP700 in the project tree | Basic Panel runtime has no VBScript host | Switch target to TP700 Comfort, or use visibility / faceplate method |
| Object visible despite visibility animation = 0 | Animation is bound to the wrong tag index, or the PLC DB array length does not match the HMI tag array length | Compare the HMI tag length to the PLC DB array; recompile and reload |
| Openness error "HmiTag not found" | Tag name uses a different culture or special characters, or the tag table has duplicates | Use the fully qualified target.Tags.Find(...) with the exact name; check the HMI tag table for duplicates |
| Faceplate instance does not update | Interface tag of the instance was not linked to a concrete HMI tag or DB element | Open faceplate instance properties and set each interface property to a concrete HMI tag or array element |
| Quality BAD on a status bit | PLC DB has fewer elements than the HMI tag array length | Resize the PLC array to match the HMI tag, recompile, and download both PLC and HMI |
| KTP700 download fails after a script was added | A script was authored on a Comfort target and the project was later switched to a KTP700 Basic | Open the project properties, verify the target device is the KTP700 Basic, then delete the script and the scheduled task that referenced it |
| VBScript runs in the simulator but not on the panel | Project was not recompiled after the script was edited, or the script exceeds the panel's memory budget | Recompile, re-download, and check the panel log for "Script memory exceeded" |
| Cyclic VBScript blocks the panel UI | Polling interval is too short and the script body is too heavy | Raise the interval to 500 ms or longer, move heavy logic into a PLC block, and keep the script to property assignments only |
FAQ
Does the KTP700 Basic Panel support VBScript?
No. KTP700 Basic is a SIMATIC HMI Basic Panel whose runtime (firmware V16.0.x) contains no script engine. For runtime scripting, use a TP700 Comfort Panel or a WinCC RT Advanced / Professional PC runtime.
How can I dynamically show or hide many HMI objects on a KTP700?
Pre-allocate the maximum number of objects on the screen and bind each object's Visibility animation to a bit from an HMI tag array populated by the PLC. Combine with faceplates to keep the project size manageable.
What is the difference between array multiplexing and faceplates?
Multiplexing re-binds one object's tag references at runtime to a tag selected by an index. Faceplates instantiate a reusable template many times, each with its own index tag. Faceplates scale better above roughly 30 instances on Comfort Panels.
Can TIA Portal Openness create HMI objects at runtime?
No. Openness runs only on the engineering workstation during project compilation. The resulting HMI project is then downloaded to the panel like any other project.