Industry Sector, IA&DT

5.4Expanding the program

Next, we will check whether faulty information is contained in the input parameters of the

'calculate_tankcontent' block. Another value 'high_max' is also passed to the block. This indicates the height of the tank.

The block is now to analyze whether the fill-level of the tank is less than zero or greater than the specified tank height. It is also to be checked whether the diameter was specified as less than zero.

If there is an error, the Boolean output parameter 'er' should return TRUE and the value of the 'Content' parameter should be -1.

Expanding the assignment list / tag table:

Address

Symbol

Data type

Comment

%Q1.7

Error bit

BOOL

Error, unable to perform calculation

Expansion of the interface of the function FC140:

calculate_tankcontent

Type

Symbol

Data type

Comment

 

IN

high_max

REAL

in meters

 

OUT

er

REAL

er = 1, there is an error, content = -1

Function call: Representation in FBD

FC140

calculate_tankcontent

Fill level:

REAL

high_max: REAL

Diameter: REAL

BOOL :er

REAL :content

SCE Training Curriculum

Page 26 of 30

To be used only at Educational and R&D Facilities

TIA Portal Module 040-020, Edition 03/2013

 

Unrestricted / © Siemens AG 2013. All Rights Reserved

SCE_EN_040-020_R1209_Startup Programming in High-Level Languages with S7-SCL and SIMATIC S7-300

 

 

 

 

Page 26
Image 26
Siemens TOA portal module 040-020 manual Expanding the program, Expanding the assignment list / tag table