Вы находитесь на странице: 1из 16

Creating New Blocks with SCL

CFC

SFC

WIN CC
0000

Y1 000.0 % V1

P1 0000.0 MBAR
INERTGAS

0000

V2
Y2 000.0 % V4 P4 0000.0 MBAR
ABLUFT1
F1
V5 P5 0000.0 MBAR
R1
PC

0000.0
0000.0 MBAR

ABLUFT2
V3
V6 P6 0000.0 MBAR
ABLUFT3

A1 0000.0 %
Reaktor 01
M1

Library

SCL

produkt

Database

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.1

SITRAIN
Siemens Automation and Drives Training

Overview

SCL
Definition of the block name, the
input parameters and output
parameters, including the default
values
High-level language

for defining own


function blocks

Algorithm description in
structured text
Block compilation and debugging

PASCAL-type

syntax, therefore
very powerful
Compiler and

Inserting into the existing block library


Using the block in the CFC Editor

debugger are
system components
SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.2

SITRAIN
Siemens Automation and Drives Training

User Block: Structures


FB
FC
OB
DB
UDT

IF
CASE

Block type

Block attribute
VAR_INPUT
VAR_OUPUT
VAR_IN_OUT

FOR
WHILE
REPEAT

VAR
VAR_TEMP
Algorithm

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.3

CONTINUE
EXIT
GOTO
RETURN

SITRAIN
Siemens Automation and Drives Training

Demonstration: Arithmetic Block

ARIT
Arithmetic block

R X1
R X2
R X3

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Y R

SCL source
Templates
Variable declaration
Algorithm
Compile + Load
Test

Date:
16.01.2014
File:ST-PCS7SY1_scl.4

SITRAIN
Siemens Automation and Drives Training

Menu Insert

-> Block Template

-> Control Structure

OB
FB
FC
Comment
Constant
Parameter
DB
Instance DB
DB Referencing UDT
UDT

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

IF
CASE
FOR
WHILE
REPEAT

Date:
16.01.2014
File:ST-PCS7SY1_scl.5

SITRAIN
Siemens Automation and Drives Training

Men Einfgen

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.6

SITRAIN
Siemens Automation and Drives Training

User Block: Startup Characteristics

OB n
FBx

FBx
SFC6 RD_SINFO
n

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Cyclic interrupt

FBx

Startup

OB m

Date:
16.01.2014
File:ST-PCS7SY1_scl.7

Special case

OB

SITRAIN
Siemens Automation and Drives Training

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.8

SITRAIN
Siemens Automation and Drives Training

Compiler and Debugger

Project
S7 station

SCL

CPU
Symbols
1. Edit block.
S7 program
2. Compile.

3. Load in the CPU.

Sources

4. Debug.
Blocks

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.9

SITRAIN
Siemens Automation and Drives Training

Appendix: Source Texts

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Simulation block
REACTOR

Date:
16.01.2014
File:ST-PCS7SY1_scl.10

SITRAIN
Siemens Automation and Drives Training

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.11

SITRAIN
Siemens Automation and Drives Training

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.12

SITRAIN
Siemens Automation and Drives Training

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.13

SITRAIN
Siemens Automation and Drives Training

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.14

SITRAIN
Siemens Automation and Drives Training

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.15

SITRAIN
Siemens Automation and Drives Training

SIMATIC PCS 7
Siemens AG 2001. All rights reserved.

Date:
16.01.2014
File:ST-PCS7SY1_scl.16

SITRAIN
Siemens Automation and Drives Training