Programmatically Opening and Closing Global Popups with SSMOpenTopField and SSMCloseTopField in SIMATIC PCS 7

Programmatically Opening and Closing Global Popups with SSMOpenTopField and SSMCloseTopField in SIMATIC PCS 7

In SIMATIC PCS 7 WinCC, to open a global popup window above all process pictures triggered by a PLC tag, call the Split Screen Manager function SSMOpenTopField("1", "Popup.pdl") in a C-action. To close this window automatically when the tag resets or conditions clear, execute SSMCloseTopField("1") from the tag action. Alternatively, call SetVisible(GetParentPicture(lpszPictureName), GetParentPictureWindow(lpszPictureName), FALSE); from within the opened PDL itself.

Table of Contents

The Split Screen Manager (SSM) TopField Window Architecture

SIMATIC PCS 7 uses the Split Screen Manager (SSM) to construct the operator interface:
* The Layered Workspace:
The WinCC screen layout is built from a root template (@screen.pdl) hosting top overview banners, bottom alarm lines, and a central workspace (@1001.pdl or @1002.pdl).
* The TopField Picture Windows:
Embedded within the background template @1001.pdl are pre-allocated floating picture windows designated as @TOP01 through @TOP20.
* The SSMTopField Mechanism:
When an engineer or system event calls SSMOpenTopField(), the Split Screen Manager loads the requested picture into one of these high-priority @TOP picture windows. Because they sit at the topmost Z-order of the entire SCADA framework, TopField windows float permanently above all process screens regardless of operator navigation.

Why Standard Picture Windows Differ from SSM TopFields

Standard Picture Windows placed inside user graphics (e.g., Area01.pdl) are child objects of that specific screen. When an operator navigates to another area (e.g., Area02.pdl), child picture windows are destroyed. In contrast, an SSM TopField window persists across screen changes, making it ideal for plant-wide emergency interlock notices, sequence phase confirmation prompts, and evacuation alarms.

API Comparison: SSMOpenTopField vs SSMCloseTopField Functions

The Split Screen Manager provides paired C-functions declared in apdefap.h:

Function CallParametersAction / BehaviorExecution ScopeSSMOpenTopField(char* lpszFieldNo, char* lpszPictureName)Loads PictureName into window @TOP<FieldNo> and sets visibleGlobal (Floats above all screens)SSMOpenTopFieldFixedSize(char* lpszFieldNo, char* lpszPictureName)Loads picture and locks window borders against operator resizingGlobal (Locked dimensions)SSMCloseTopField(char* lpszFieldNo)Hides window @TOP<FieldNo> and unloads the loaded PDLGlobal (Clears topfield display)SetVisible (Child API)(lpszParentPic, lpszWindow, FALSE)Closes a local user picture window on a specific base screenLocal to single screen

Step-by-Step Procedure to Implement Tag-Triggered Popups with Auto-Close

  1. Design the Popup Screen:
    In Graphic Designer, create Popup_Interlock_Notice.pdl. Set dimensions (e.g., 400x250 pixels). Add status messages and an optional manual acknowledge button.
  2. Create Global C-Action Triggered by Tag:
    * Open Global Script -> C-Editor -> Actions.
    * Create a new action named GSC_InterlockPopup.pas.
    * Set the trigger to Tag Trigger tied to your PLC boolean tag (e.g., Plant/Reactor1.InterlockActive#Value), set to Upon Change.
  3. Write the Bidirectional Open/Close Logic:
    ```c
    #include "apdefap.h"
    int gscAction(void)
    {
    BOOL bInterlockActive = GetTagBit("Plant/Reactor1.InterlockActive#Value");

    if (bInterlockActive == TRUE)
    {
    // Open popup in TopField slot 1
    SSMOpenTopField("1", "Popup_Interlock_Notice.pdl");
    }
    else
    {
    // Automatically close TopField slot 1 when interlock clears
    SSMCloseTopField("1");
    }
    return 0;
    }
    ```
    4. Compile and Save:
    Compile the C-script. Ensure zero syntax errors.
    5. Activate Global Script Runtime:
    In WinCC Explorer -> Computer Properties -> Startup, ensure Global Script Runtime is checked. Save and start runtime.

Alternative Close Mechanisms: Direct Connection and Internal Scripting

If the popup should also be dismissible manually by the operator from within the window:
* Manual Close Button C-Script:
Attach the following C-script to a button inside Popup_Interlock_Notice.pdl:
c // Closes the containing TopField window from inside itself SetVisible(GetParentPicture(lpszPictureName), GetParentPictureWindow(lpszPictureName), FALSE);
* Direct Connection in Graphic Designer:
On the button click event, select Direct Connection. Set Target: Current Window, Property: Display, and Source: Constant 0.

Verification

To verify programmatic opening and auto-closing:
1. Launch WinCC OS Runtime.
2. Force the PLC interlock tag to 1 in the controller or S7-PLCSIM.
3. Confirm that Popup_Interlock_Notice.pdl immediately appears in the center of the monitor floating above the active screen.
4. Navigate across multiple plant areas (e.g., from Boiler to Tank Farm). Confirm the popup remains visible on top.
5. Force the PLC interlock tag back to 0. Confirm that the popup window closes automatically without operator clicks.

Limitations and Operational Precautions

  • TopField Slot Collisions: If multiple scripts attempt to call SSMOpenTopField("1", ...) simultaneously for different events, the second script will overwrite the first. Designate unique slot numbers (e.g., Slot 1 for Reactor Interlocks, Slot 2 for Evacuation Prompts).
  • Tag Trigger Execution Frequency: Avoid using high-frequency cyclic triggers (e.g., every 250 ms) for global scripts opening windows. Always use Upon Change tag triggers to prevent script queue saturation.
  • Do Not Edit @1001.pdl Directly: Modifying system template files like @1001.pdl is strictly discouraged, as running the OS Project Editor will overwrite manual edits.

Engineer FAQ

Technical References

Related Articles

Related Tags

  • SSMOpenTopField
  • SSMCloseTopField
  • Split Screen Manager
  • Global Script C
  • TopField Popups
  • WinCC Graphic Designer
8 respuestas