Siemens Industry Online Support
Siemens AG
Entry type: Application example Entry ID: 81662739, Entry date: 01/30/2019

Library for determining statistical distributions in a S7-1200/1500 PLC

  • Entry
  • Associated product(s)
You can use SIMATIC S7 PLCs for preprocessing measured value data. This article provides some standard functions for statistical processing and display of measured values.

As a rule, the raw data of the measured values read in by the periphery must be pre-processed in order to make statements regarding the quality. Standard functions here are statements on statistical distribution, various mean value calculations, smoothing functions, regressions, etc. In this article you will find suitable functions for the S7-1200 and S7-1500 on the PLC as well as visualization components for WinCC RT Professional.   

Library "LMeasure"

To be able to process measured values from processes already in the S7-PLC, you receive a library for measured value processing. 

The following blocks are contained:

  • LMeasure_Boxplot
    Calculates the statistical information of the minimum, 25% quartile, median, 75% quartile and the maximum value of a series of measured values necessary for the representation of a boxplot. In addition, the block calculates outlier statistics and a measure for the skewness of a distribution. A .NET Control for WinCC Professional is available for this block.
  • LMeasure_Histogram
    Represents the frequency distribution of a series of measured values in the form of a histogram according to parameterizable classes. A .NET Control for WinCC Professional is available for this block.
  • LMeasure_SimpleSmoothingFC
    Performs a smoothing of the measured values by calculating the linear mean value by three points.
  • LMeasure_SmoothByPolynomFB
    Carries out a smoothing of the measured values by a 3rd degree compensating polynomial.
  • LMeasure_DifferenceQuotientFC
    Carries out a numerical differentiation of the equidistantly sampled measured values. This function uses a 3rd degree polynomial to smooth noisy input signals. 
  • LMeasure_RegressionLine
    Calculates a linear regression with the slope and the intersection point with the Y-axis as initial parameters from a measured value data set.

WinCC-Controls "Boxplot" and "Histogram"

The two WinCC controls "Boxplot" and "Histogram" are available for visualizing the information from the blocks "LMeasure_Boxplot" and "LMeasure_Histogram".


Application example for Boxplot and Histogram Components

In order to be able to make statements about the statistical distribution of measured values from a process, more complex calculations are necessary. Extensive evaluations are usually carried out on PCs with special statistics programs. The required raw data is transferred from the S7-PLC. If you want to display the evaluations with WinCC Runtime Professional, you can create your own .Net Controls with Visual Studio.

This application example shows you how to integrate the WinCC controls "Boxplot" and "Histogram" into your project and how to supply data using the blocks "LMeasure_Boxplot" and "LMeasure_Histogram". In order to draw a Boxplot or a Histogram the data must be prepared. This function is performed by the blocks "LMeasure_Boxplot" and "LMeasure_Histogram".




Library "LMeasure"
  Documentation (968,3 KB) 
 Registrierung notwendig  Library TIA Portal V15.1 (647,4 KB) 

WinCC-Controls Boxplot and Histogram
 Registrierung notwendig  WinCC .Net Controls (124,6 KB) 

Application example for Boxplot and Histogram Components
  Documentation (1,2 MB) 
 Registrierung notwendig  Project TIA Portal V15.1 (34,8 MB) 

Last Changes
Newly created

Further information
Library of General Functions (LGF) for STEP 7 (TIA Portal) and S7-1200 / S7-1500

Creation of .NET controls for WinCC Professional

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit