Skip to main content
  1. Posts/

WinCC Unified - Clamping Tag Value

Author
Ian Loke
Tech generalist based in Singapore with 10+ years in Industrial Automation, IIoT, OT Security, and Energy. I go deep on the things I’m curious about.
Table of Contents

In my previous post, I shared the importance of setting tag limits to prevent bad data from causing issues in SCADA systems. Now, let’s talk about another essential safeguard — clamping values.

Clamping vs. Tag Limits
#

While both clamping and tag limits help control data quality, they serve different purposes:

  • Tag limits: Used to filter out and reject values that exceed a predefined range, preventing them from being processed at all.

  • Clamping: Adjusts out-of-range values to stay within acceptable limits, ensuring the system continues to function without interruption.

Steps to implement Clamping in WinCC Unified
#

  1. Create Data, Lower and Upper Bound Tags

    • Open the Tag Table and create a data tag (e.g., Data_Integer_Value), a lower bound tag and an upper bound tag
    • Set the lower and upper bound tags with their respective Start value (e.g. upper bound = 100, lower bound = 0)
      Wincc Unified 3
  2. Link Data Tag to a Screen Element

    • Add a new Screen.
    • In the new screen, add an IO Field element.
    • Link the Process Value of the IO Field to the tag Data_Integer_Value.
      Wincc Unified 2
  3. Define Upper and Lower Clamping Function

    • Add a Input finished event with the code below.
export function IO_field_1_OnInputFinished(item, value) {

  let tag = Tags("Data_Integer_Value");
  let lower = Tags("lower_bound").Read();
  let upper = Tags("upper_bound").Read();
  let result;

  if(value < lower){
    result = lower;
  }
  else if (value > upper){
    result = upper;
  }
  else{
    result = value;
  }

  tag.Write(result);
  return result;
}
Wincc Unified 1
  1. Run Simulation Mode to verify the range settings
    • Start Simulation Mode.
    • Try entering values beyond the defined limits to see how the system handles them.
WinCC Unified Simulation

Related

Deploying Nikola Site to Cloudflare Pages

·1 min
This site is built on Nikola and deployed on Cloudflare Pages. Being a static site generator, you are able to deploy your Nikola site to Pages by following the Static HTML Guide. As an example, here is an example of Cloudflare Pages settings for a Nikola site hosted on a Github repository.