SCE en 030-050 R1209 Analogwertverarbeitung
SCE en 030-050 R1209 Analogwertverarbeitung
SCE en 030-050 R1209 Analogwertverarbeitung
Page 1 of 31
Advanced training
Please get in touch with your regional SCE contact for information on regional Siemens SCE advanced training
siemens.com/sce/contact
Page 2 of 31
Preface............................................................................................................................................................. 4
Notes on programming for SIMATIC S7-300................................................................................................... 6
2.1 SIMATIC S7-300 automation system ......................................................................................................... 6
2.2
3.
4.
5.
6.
7.
Page 3 of 31
1.
Preface
The SCE_EN_030-050 module contents form part of the Advanced functions for PLC programming
training unit and explain analog value processing with SIMATIC S7.
Basics of PLC
programming
Module 10, Module 20
Plant simulation with
SIMIT Module 150
Advanced functions for
PLC programming
Module 30
Other programming
languages
Module 40
Safety technology
Module 80
PROFIBUS
Module 60
Sensor technology
Module 110
PROFINET
Module 70
AS-Interface
Module 50
Process visualization
(HMI) Module 90
Drive technology
Module 100
Learning objective:
In this module, the reader will learn how to program limit monitoring for the fill level of a tank. A sensor
will provide the fill level of the tank as an analog value. The module explains the basic principles and
outlines the procedure using a detailed example.
Requirements:
To successfully work through this module, the following knowledge is required:
Page 4 of 31
PC Pentium 4, 1.7 GHz 1 (XP) 2 (Vista) GB RAM, approx. 2 GB of free hard disk space
Operating system Windows XP Professional SP3 / Windows 7 Professional / Windows 7
Enterprise / Windows 7 Ultimate / Windows 2003 Server R2 / Windows Server 2008 Premium SP1,
Business SP1, Ultimate SP1
Software: STEP 7 Professional V11 (Totally Integrated Automation (TIA) Portal V11)
SIMATIC S7-300 PLC, e.g., CPU 315F-2PN/DP with 16DI/16DO signal module. The inputs must
be fed out to a control panel.
2 STEP 7 Professional
V11 (TIA Portal)
1 PC
3 Ethernet connection
Page 5 of 31
2.1
2.2
SIMATIC S7-1200
SIMATIC S7-300
SIMATIC S7-400
SIMATIC WinAC
STEP 7 Professional V11 provides the following functions for plant automation:
-
Programming
Documentation
Creation of visualizations for the SIMATIC Basic Panels using the integrated WinCC Basic
software
Visualization solutions for PCs and other panels can also be created with other WinCC software
packages
Page 6 of 31
Analog signals
In contrast to a binary signal, which can assume only two signal states (Voltage present +24 V and
Voltage not present 0 V), analog signals can assume any value within a defined range. An example of
a typical analog sensor is a potentiometer. Depending on the position of the rotary button, any
resistance can be set, up to the maximum value.
Examples of analog variables in control engineering:
-
etc.
These variables are converted to electrical voltages, currents, or resistances using a measuring
transducer. If, for example, a speed is to be recorded, the speed range of 500 to 1500 rpm can be
converted to a voltage range of 0 to +10 V using a transducer. At a measured speed of 865 rpm, the
measuring transducer then outputs a voltage value of +3.65 V.
500
1500
rpm
1500
U/min
865
365
10
V:1000
1000U/min
rpm ==0.01
10V:
0,01V/rpm
V/U/min
1000U/min
rpm
1000
365
rpm x 0.01
V/rpm
= 3.65
365 U/min
x 0,01
V/U/min
= 3,65
10V
+10
+10VV
0V
These electrical voltages, currents, or resistances are then connected to an analog module that
digitalizes this signal.
Note: Some analog modules can process a variety of signal types. This must be set in the device
overview. Please refer to the information in the device manuals.
Page 7 of 31
00A/0V
A/0 V
10
V: 2048
2048==0,0048828
0.0048828
10V:
Voltage
es knnen
Spannungs
differences
<5 mV can be detected
Bit
1111
bits
2048
2048
Page 8 of 31
werden
Type and
description
Size in
bits
Format option
Example
BOOL (bit)
Boolean text
TRUE/FALSE
TRUE
BYTE (byte)
Hexadecimal
B#16#0 to B#16#FF
B#16#10
WORD (word)
16
Binary number
2#0 to 2#1111_1111_1111_1111
2#0001_0000_0000_0000
Hexadecimal
number
W#16#0 to W#16#FFFF
W#16#1000
BCD
C#0 to C#999
C#998
Decimal number
(unsigned)
B#(0.0) to B#(255.255)
B#(10.20)
Binary number
2#0 to
2#1111_1111_1111_1111_1111_1111
_1111_1111
2#1000_0001_0001_1000_10
11_1011_0111_1111
Hexadecimal
number
DW#16#0000_0000 to
DW#16#FFFF_FFFF
DW#16#00A2_1234
Decimal number
(unsigned)
B#(0.0.0.0) to B#(255.255.255.255)
B#(1.14.100.120)
DWORD
(double word)
32
INT (integer)
16
Decimal number
-32768 to 32767
DINT
(integer, 32 bit
32
Decimal number
L#-2147483648 to L#2147483647
L#1
32
IEEE floating-point
number
1.234567e+13
S5TIME
(Simatic time)
16
S7 time in
increments of 10
ms
S5T#0H_0M_0S_10MS to
S5T#2H_46M_30S_0MS and
S5T#0H_0M_0S_0MS
S5T#0H_1M_0S_0MS
S5TIME#1H_1M_0S_0MS
TIME
(IEC time)
32
IEC time in
increments of 1
ms, signed integer
-T#24D_20H_31M_23S_648MS to
T#24D_20H_31M_23S_647MS
T#0D_1H_1M_0S_0MS
TIME#0D_1H_1M_0S_0MS
DATE
(IEC date)
16
IEC date in
increments of 1
day
D#1990-1-1 to D#2168-12-31
DATE#1994-3-15
TIME_OF_DAY
32
Time of day in
increments of 1 ms
TOD#0:0:0.0 to TOD#23:59:59.999
TIME_OF_DAY#1:10:3.3
CHAR (character)
ASCII character
A, B etc.
Note: The INT and REAL data types play a major role in analog value processing since read-in
analog values exist as integers in INT format, and for accurate further processing only REAL floating
point numbers are a possibility due to the rounding errors with INT.
Page 9 of 31
Each analog value (channel) occupies one input or output word. The format is Int, an integer.
The addressing of the input and output words is based on the addressing in the device overview.
For example:
Here, the address of the first analog input would be %IW 272, the address of the second analog input
would be %IW 274, the address of the analog output would be %QW 272 , and so on.
Page 10 of 31
20 mA/10 V
10 mA/5 V
Often, these digitalized values must still be scaled by further processing them in the PLC in an
appropriate manner.
5.1
Page 11 of 31
Symbol
AI_Fuel_Tank1
Tank1_max
Tank1_min
Page 12 of 31
Comment
Analog input fill level Tank1
Display fill level > 990 liters
Display fill level < 110 liters
The central tool is the Totally Integrated Automation Portal, which is opened here with a
double-click. ( TIA Portal V11)
2.
Programs for the SIMATIC S7-300 are managed in projects. Start by creating a project in the
portal view ( Create new project Tank_Analog Create).
Page 13 of 31
First steps for configuring are now suggested. We want to start with Configure a device.
( First steps Configure a device)
4.
Next, we will Add a new device. Choose the CPU 315F-2 PN/DP with the appropriate order
number from the catalog. ( Add new device Control_Tank CPU 315F-2 PN/DP
6ES7 . Add)
Page 14 of 31
The software now switches automatically to the project view containing the opened hardware
configuration. Additional modules can now be added from the hardware catalog (on the right!)
and the addresses of the inputs/outputs can be set in the Device overview. Here, there is one
I/O module with 16 inputs (addresses %I0.0 - %I1.7) and 16 outputs (addresses %Q0.0 %Q1.7). ( Device overview DI/DO DI16/DO16 x 24V/0.5A 6ES7 323-1BL00-0AA0
I address: 01 Q address: 01)
Page 15 of 31
After that, drag an AI/AO module with 4 analog inputs (addresses %IW272 / %IW274 / %IW276
/ %IW278) and 2 analog outputs (addresses %QW272 / %QW274) onto slot 5. ( Device
overview AI/AO AI4/AO2 x 8Bit 6ES7 334-0CE01-0AA0 I address: 272279 Q
address: 272275)
Page 16 of 31
To ensure that the software will access the correct CPU later, the IP address and the subnet
mask of the CPU must be set. ( Properties General PROFINET interface [X2]
Ethernet addresses IP protocol IP address: 192.168.0.1 Subnet mask: 255.255.255.0)
(see also: SCE_EN_030-010 module on setting the programming interface.)
Page 17 of 31
Because modern programming uses tags and not absolute addresses, the global PLC tags
must be defined here.
These global PLC tags are descriptive names with a comment for each input and output used in the
program. The global PLC tags can then be accessed later during programming via their names.
These global tags can be used in all blocks anywhere in the program.
In the project tree, select Control_Tank [CPU 315F-2 PN/DP] and then PLC tags. Double-click
the default tag table to open it, and enter the names for the inputs and outputs as shown below.
( Control_Tank [CPU 315F-2 PN/DP] PLC tags default tag table)
Page 18 of 31
Next, we want to create the function with the program. In the project tree, select Control_Tank
[CPU 315F-2 PN/DP] and then Program blocks. Then, double-click Add new block.
( Control_Tank [CPU 315F-2 PN/DP] Program blocks Add new block)
Page 19 of 31
Page 20 of 31
Designation
Function
Available in
Input parameters
Input
Output parameters
Output
InOut
In/out parameters
Designation
Function
Available in
Temp
Static
Page 21 of 31
Page 22 of 31
Note: Refer to the online help for information on the function and connection of the SCALE block.
Page 23 of 31
Page 24 of 31
16. For the Language, choose the FBD function block diagram programming language. ( FBD
OK)
Page 25 of 31
18. The Fill level monitoring [FC1] block can then be moved into Network 1 of the Main [OB1]
block using a drag-and-drop operation. Don't forget to document the networks in the Main [OB1]
block. ( Fill level monitoring [FC1])
Page 26 of 31
Page 27 of 31
Page 28 of 31
Note: Details on setting the PG/PC interface can be found in the SCE_EN_020-010 module.
Page 29 of 31
23. The successful load result is now displayed in a window. To place the CPU315F-2 PN/DP back
in RUN mode, click Start all and then Finish. ( Start all Finish)
Page 30 of 31
Page 31 of 31