Creating New Blocks with SCL
SCL
CFC SFC WIN CC
Library
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 ABLUFT2
0000.0
PC V3
0000.0 MBAR
V6 P6 0000.0 MBAR
ABLUFT3
A1 0000.0 %
Reaktor 01
M1
produkt
Database
SIMATIC PCS 7 Date: 16.01.2014
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: 16.01.2014
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: 16.01.2014
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: 16.01.2014
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: 16.01.2014
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.5
Menü Einfügen
SIMATIC PCS 7 Date: 16.01.2014
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: 16.01.2014
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.7
SIMATIC PCS 7 Date: 16.01.2014
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: 16.01.2014
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: 16.01.2014
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.10
SIMATIC PCS 7 Date: 16.01.2014
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.11
SIMATIC PCS 7 Date: 16.01.2014
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.12
SIMATIC PCS 7 Date: 16.01.2014
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.13
SIMATIC PCS 7 Date: 16.01.2014
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.14
SIMATIC PCS 7 Date: 16.01.2014
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.15
SIMATIC PCS 7 Date: 16.01.2014
SITRAIN
Siemens Automation and Drives Training
Siemens AG 2001. All rights reserved. File:ST-PCS7SY1_scl.16