You are on page 1of 16

Creating New Blocks with SCL

SCL

CFC SFC WIN CC

Library
0000 Y1000.0% V1 P10000.0MBAR
INERTGAS
0000

V2
Y2000.0% V4 P40000.0MBAR
ABLUFT1
F1
V5 P50000.0MBAR
R1 ABLUFT2
0000.0
PC V3
0000.0MBAR
V6 P60000.0MBAR
ABLUFT3
A10000.0%

Reaktor 01
M1

produkt

Database
Database

SIMATIC PCS 7 Date: 30.04.20


SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.1
Overview

SCL

Definition of the block name, the


input parameters and output
parameters, including the default
values

Algorithm description in
 High-level language structured text
for defining own
function blocks Block compilation and debugging
 PASCAL-type
syntax, therefore Inserting into the existing block library
very powerful
 Compiler and Using the block in the CFC Editor
debugger are
system components

SIMATIC PCS 7 Date: 30.04.20


SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.2
User Block: Structures

FB
FC IF
OB Block type CASE
DB
UDT Block attribute

VAR_INPUT
VAR_OUPUT
VAR_IN_OUT FOR
VAR WHILE
REPEAT
VAR_TEMP

Algorithm

CONTINUE
? EXIT
GOTO
RETURN

SIMATIC PCS 7 Date: 30.04.20


SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.3
Demonstration: Arithmetic Block

ARIT
Arithmetic block

R X1 Y R
R X2
• SCL source
R X3
• Templates
• Variable declaration
• Algorithm
• Compile + Load
• Test

SIMATIC PCS 7 Date: 30.04.20


SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.4
Menu Insert

-> Block Template -> Control Structure

OB IF
FB CASE
FC FOR
Comment WHILE
Constant REPEAT
Parameter
DB
Instance DB
DB Referencing UDT
UDT

SIMATIC PCS 7 Date: 30.04.20


SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.5
Menü Einfügen

SIMATIC PCS 7 Date: 30.04.20


SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.6
User Block: Startup Characteristics

OB n
FBx FBx
SFC6 RD_SINFO

n
OB
m

Cyclic interrupt

Special case
OB m
FBx
Startup

SIMATIC PCS 7 Date: 30.04.20


SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.7
SIMATIC PCS 7 Date: 30.04.20
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.8
Compiler and Debugger

Project

S7 station

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

3. Load in the CPU.


Sources

4. Debug.

Blocks

SIMATIC PCS 7 Date: 30.04.20


SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.9
Appendix: Source Texts

• Simulation block
REACTOR

SIMATIC PCS 7 Date: 30.04.20


SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.10
SIMATIC PCS 7 Date: 30.04.20
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.11
SIMATIC PCS 7 Date: 30.04.20
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.12
SIMATIC PCS 7 Date: 30.04.20
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.13
SIMATIC PCS 7 Date: 30.04.20
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.14
SIMATIC PCS 7 Date: 30.04.20
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.15
SIMATIC PCS 7 Date: 30.04.20
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.16

You might also like