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

Industry Automation and Drive Technologies - SCE

TIA Training Document Page 1 of 36 Module


M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10














Training Manual for Integrated Automation
Solutions
Totally Integrated Automation (TIA)

MODULE M5
Analog Value Processing
with the
SIMATIC S7-1200 with TIA Portal V10





Industry Automation and Drive Technologies - SCE


TIA Training Document Page 2 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10










































This manual was prepared for training purposes by Siemens AG for the project Siemens Automation Cooperates
with Education (SCE).
Siemens AG does not guarantee the contents of this document.

Passing on this document as well as copying it, using and communicating its contents is permitted within public
training and continued education facilities. Exceptions require the written permission by Siemens AG (Michael
Knust michael.knust@siemens.com).
Violators are held liable to pay damages. All rights -including translation- reserved, particularly if a patent is
granted, or a utility model or design is registered.

We wish to thank the Michael Dziallas Engineering corporation and the instructors of vocational schools as well
as all those who provided support during the preparation of this manual.




Industry Automation and Drive Technologies - SCE


TIA Training Document Page 3 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

Page

1. Preface .......................................................................................................................................................5
2. Notes on Programming the SIMATIC S7-1200 ..........................................................................................7
2.1 Automation System SIMATIC S7-1200 ......................................................................................................7
2.2 Programming Software STEP 7 Basic V10.5 (TIA Portal V10.5) ...............................................................7
3. Analog Signals............................................................................................................................................8
4. Data Types for the SIMATIC S7-1200......................................................................................................10
5. Entering/Reading Out Analog Values .......................................................................................................11
5.1 Normalizing Analog Values.......................................................................................................................12
6. Sample Task: Level Monitoring of a Tank ................................................................................................13
7. Programming Level Monitoring for the SIMATIC S7-1200 .......................................................................14


Industry Automation and Drive Technologies - SCE


TIA Training Document Page 4 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10


The following symbols serve as a guide through this module:


Information


Installation


Programming


Sample Task


Notes










Industry Automation and Drive Technologies - SCE


TIA Training Document Page 5 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

1. Preface

Regarding its content, Module M5 is part of the instruction unit 'SIMATIC S7-1200 and TIA Portal. It
describes the programming of analog value processing with the SIMATIC S7-1200.





















Objective

In Module M5, the reader will learn how to program limit monitoring for an analog value. The
controller (PLC) in this case is the SIMATIC S7-1200, and the program is generated with the
programming tool TIA Portal. Module M5 provides the fundamentals and illustrates the steps involved
by using a detailed example.

Prerequisites

To successfully work through Module M5, the following knowledge is assumed:
How to handle Windows
Fundamentals of PLC programming with the TIA Portal (for example, Module M1 'Startup
Programming the SIMATIC S7-1200 with TIA Portal V10)
Blocks for the SIMATIC S7-1200 (for example, Module M2 Block Types of the
SIMATIC S7-1200)
Basics of
STEP7 Programming
2 to 3 days Modules A
Industrial Fieldbus
Systems
2 to 3 days Modules D
Additional Functions of
STEP 7 Programming
2 to 3 days Modules B
Process
Visualization
2 to 3 days Modules F
Programming
Languages
2 to 3 days Modules C
IT Communication
with SIMATIC S7
2 to 3 days Modules E
System Simulation
with SIMIT SCE
1 to 2 days Modules G
Frequency Converter
at SIMATIC S7
2 to 3 days Modules H
SIMATIC S7-1200 and
TIA Portal
2 to 3 days Modules M
Industry Automation and Drive Technologies - SCE


TIA Training Document Page 6 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

Hardware and Software required

1 PC Pentium 4, 1.7 GHz 1 (XP) 2 (Vista) GB RAM, free disk storage approx. 2 GB;
operating system Windows XP (Home SP3, Professional SP3)/Windows Vista (Home
Premium SP1, Business SP1, Ultimate SP1)
2 Software STEP7 Basic V10.5 SP2 (Totally Integrated Automation (TIA) Portal V10.5)
3 Ethernet connection between PC and CPU 1214C
4 PLC SIMATIC S7-1200 with at least one analog value input; for example CPU 1214C. The input
has to be connected to a sensor or potentiometer.























1 PC

2 STEP7 Basic
(TIA Portal)

4 S7-1200 with
CPU 1214C
3 Ethernet Connection

Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 7 ofn 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

2. Notes on Programming the SIMATIC S7-1200

2.1 Automation System SIMATIC S7-1200

The automation system SIMATIC S7-1200 is a modular mini-control system for the lower
performance range.
There is a comprehensive module spectrum for optimized adaptation to the automation task.
The S7 controller consists of a CPU that is equipped with inputs and outputs for digital and analog
signals.
Additional input and output modules (IO modules) can be installed if the integrated inputs and outputs
are not sufficient for the desired application.
If needed, communication processors for RS232 or RS485 are added.
An integrated TCP/IP interface is obligatory for all CPUs.

With the S7 program, the PLC monitors and controls a machine or a process.
The IO modules are polled in the S7 program by means of the input addresses (%I) and addressed
by means of output addresses (%Q) <<?>>.

The system is programmed with the software STEP 7 Basic V10.5.

2.2 Programming Software STEP 7 Basic V10.5 (TIA Portal V10.5)

The software STEP 7 Basic V10.5 is the programming tool for the automation system
- SIMATIC S7-1200
With STEP 7 Basic V10.5, the following functions can be utilized for automating a system:
- Configuring and parameterizing the hardware
- Specifying the communication
- Programming
- Test, commissioning and service with the start/diagnostic functions
- Documentation
- Generating visual displays for the SIMATIC basic panels

All functions are supported with detailed online help.




Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 8 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

3. Analog Signals

In contrast to binary signals that can assume only the two signal states "Voltage available +24V and
"Voltage unavailable 0V, analog signals -within a certain range- are able to assume any number of
values. .A typical example for an analog sensor is a potentiometer. Depending on the position of the
rotary button, it is possible to set any resistance, up to the maximum value.

Examples of analog variables in control engineering:
- Temperature -50 ... +150C
- Flow rate 0 ... 200l/min
- Speed 500 ... 1500 U/min
- etc.

Using a transducer, these variables are changed into electrical voltages, currents or resistances. If,
for example, speed is to be recorded, the speed range can be changed from
500 ... 1500 U/min to a voltage range of 0 ... +10V by using a transducer. For the measured speed of
865 U/min, the transducer would read out a voltage value of + 3.65 V.

365
1000 U/min
10V
10V: 1000 U/min = 0,01 V/U/min
365 U/min x 0,01 V/U/min = 3,65
0 V +10V
500 865 1500 U/min


These electrical voltages, currents and resistances are then connected to an analog module that
digitalizes this signal.

Note:
Some analog modules are able to process different signal types in this case. This has to be set in the
device overview. Please refer to the notes in the device manuals.



Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 9 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

If analog variables are processed with a PLC, the voltage, current or resistance value that was
entered has to be converted to digital information. This conversion is called analog-digital conversion
(A/D conversion). This means, for example: the voltage value of 3.65V is stored in a series of binary
digits as information. The more binary digits are used for digital representation, the higher is the
resolution. If, for example, only 1 bit were available for the voltage range 0 ... +10V, information could
be provided only as to whether the measured voltage was within the range of +5V ... +10V. With 2
bits, however, the range can be subdivided into 4 individual ranges; i.e. 0 ... 2.5/2.5 ... 5/5 ... 7.5/7.5 ...
10V. In control engineering, commercial A/D converters convert with 8 or 11 bits,
whereby 8 bits provide for 256 individual ranges, and 11 bits a resolution of 2048 individual ranges.

11 Bit
10V: 2048 = 0,0048828
es knnen Spannungs-
unterschiede <5mV erkannt
werden
0 2048
0A/0V 20mA/10V



Voltage differences of <5mV can be
detected
Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 10 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

4. Data Types at the SIMATIC S7-1200

The SIMATIC S7-1200 has a large number of different data types that are used to represent different
number formats. Below, the elementary data types are listed.





Note:
The data types INT und REAL are very important in analog value processing since entered analog
values are present as integers in the format INT. For exact further processing, only floating point
numbers REAL can be used because of the rounding error at INT.






Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 11 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

5. Entering/Reading Out Analog Values

Analog values are entered in the PLC or read out from it as word information. The words are
accessed with the following operands, for example:

%IW 64 Analog input word 64
%OW 80 Analog output word 80

Each analog value ("Channel) is assigned an input word or an output word. The format is Int, an
integer.

Addressing the input values or output values depends on the addressing in the device overview. For
example:



The address of the first analog input would be in this case %IW 64, that of the second analog input
%IW 66, and that of the analog output %QW 80.

The analog value transformation for further processing in the PLC is the same for analog inputs and
analog outputs.
The digitalized value ranges look like this:

These digitalized values often have to be normalized through further processing in the PLC.

Nominal range of the
analog value



Digitalized value
for further processing in the PLC
Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 12 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

5.1 Normalizing Analog Values

If an analog input value is present as a digitalized value, it usually has to be normalized so that the
numerical values correspond to the physical variables in the process.

Likewise, the analog output to the IO output word usually takes place only after the output value is
normalized.

In STEP7 programs, computing operations are used for normalizing. That this is carried out as exact
as possible, the values to be normalized have to be converted to the data type REAL, to keep
rounding off errors minimal.

In the chapters below, an example is provided using level monitoring for a tank.


Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 13 of 36 Moduel
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

6. Sample Task: Level Monitoring of a Tank

For our program, we are programming the monitoring of a tank level.

A sensor measures the level in a tank and converts it to the voltage signal 0 to 10V.
0V correspond to a level of 100 liters and 10V to a level of 1000 liters.

This sensor is connected to the first analog input of the SIMATIC S7-1200.
This signal is now to be entered in the function FC1, and normalized.

Then, the following is to be programmed: monitoring of and indication for the maximum permissible
level of 990 liters, and monitoring for the minimum permissible level of 110 liters.

Assignment list:

Address Symbol Data Type Comment

%IW 64 AI_level_tank1 Int Analog input level Tank1
%Q 0.0 Tank1_max Bool Indication > 990 liters
%Q 0.1 Tank1_min Bool Indication level < 110 liters





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 14 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

7. Programming Level Monitoring for the SIMATIC S7-1200

Project management and programming is carried out with the software Totally Integrated
Automation Portal.

Here, under a uniform interface, the components such as the controller, visual display and networking
of the automation solution are set up, parameterized, and programmed.
Online tools are available for error diagnosis.


The steps below show how to set up a project for the SIMATIC S7-1200 and to program the solution
for the task.
1. The central tool is the Totally Integrated Automation Portal. It is called here with a double
click ( Totally Integrated Automation Portal V10)




Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 15 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

2. Programs for the SIMATIC S7-1200 are managed in projects. We are now setting up such a
project in the portal view ( Create new project Tank_Analog Create)




Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 16 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

3. Now, First Steps are recommended for configuring.
First, we want to Configure a device ( First Steps Configure a device)





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 17 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

4. Then we Add new device with the device name Control_tank. To this end, we select from
the catalog the CPU1214C with the matching order number ( Add new device Control_tank
CPU1214C 6ES7 . Add)





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 18 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

5. Now, the software automatically changes to the project view with the hardware configuration
opened. Here, we can add additional modules from the hardware catalog (on the right!). With
drag&drop we add from the catalog the signal board for an analog output ( Catalog Signal board
AO1 x 12Bit 6ES7 232- )





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 19 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

6. In the Device Overview, we can set the addresses for the inputs/outputs. Here, the CPUs
integrated analog inputs have the addresses %I64 to %I67, and the integrated digital outputs the
addresses %AQ.0 to %Q1.1 ( Device Overview AI2 6467)





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 20 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

7. So that the software later accesses the correct CPU, its IP address and the subnet mask have to
be set ( Properties General PROFINET interface Ethernet addresses IP address:
192.168.0.1 Subnet mask: 255.255.255.0)
(refer also to M1, Chapter 3 for setting the programming interface)




Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 21 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

8. Since for modern programming we program with variables rather than with absolute addresses,
we have to specify the global PLC tags here.

These global PLC tags are descriptive names and comments for those inputs and outputs that are
used in the program. Later, during programming, we can access these global PLC tags by means of
this name.
These global tags can be used in the entire program in all blocks.

To this end, select in the project navigation Control_tank [CPU1214C DC/DC/DC] and then PLC
tags. With a double click, open the table PLC tags and enter, as shown below, the names for the
inputs and outputs ( Control_tank[CPU1214C DC/DC/DC] PLC tags PLC tags)





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 22 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

9. To create the function block FC1, select in project navigation Control_tank [CPU1214C
DC/DC/DC] and then Program blocks. Next, double click on Add new block (
Control_tank[CPU1214C DC/DC/DC] Program blocks Add new block)





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 23 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

10. From the selection, select Function(FC) and assign the name Filling_level_tank1. As
programming language, function block diagram FBD is specified. Numbering is automatic. Since this
FC1 is called by its symbolic name anyhow, the number is no longer of such importance. Accept the
inputs with OK ( Function (FC1) Filling_level_tank1 FBD OK)





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 24 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

11. The block Filling_level_tank1[FC1] then opens automatically. Before we can write the
program, however, we have to declare the interface of the block. When the interface is declared, the
local variables are specified that are known only in this block.

The variables are divided into two groups:
Block parameters that are the interface of the block for calls in the program.
Type Name Function Available in
Input parameters Input
Parameters whose value the
block reads.
Functions, function blocks and some
types of organization blocks
Output parameters Output
Parameters whose values the
block writes.
Functions and function blocks
InOut parameters InOut
Parameters whose values the
block reads when being called,
and after processing writes to
the same parameter.
Functions and function blocks

Local data used for storing intermediate results
Type Name Function Available in
Temporary local data Temp
Variables used for storing
temporary intermediate results.
Temporary data is retained for
one cycle only.
Functions, function blocks and
organization blocks
Static local data Static
Variables used for storing static
intermediate results in the
instance data block. Static data
is retained until it is rewritten;
that is, also over several cycles.
Function blocks



Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 25 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

12. When declaring local variables, the following variables are needed for our example.
Input:
tank_level_AI Here, the level sensor enters the analog value
Output:
tank_max Here, the status of the maximum indication is written to the output
tank_min Here, the status of the minimum indication is written to the output
Temp:
tank_level_real This variable is needed to store an intermediate value
tank_level_norm Here, a value for the level in the floating point format is provided, normalized to
the range 100 to 1000 liters.

In this example, it is particularly important that the correct data types are used since in the following
program, they are not compatible with the conversion functions used. For the sake of clarity, all local
variables should be provided with sufficient comments.




Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 26 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

13. After we declared the local variables, we can enter the program by using the variable names
(variables are identified with the symbol '#.) In FBD, for example, it could look like this:




Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 27 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

14. Next, the Properties of the cyclically processed block Main[OB1] are selected. Block
properties can be modified ( Properties Main[OB1])





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 28 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

15. In the properties, select the programming Language function block diagram FBD ( FBD
OK)





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 29 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

16. Now, from the programming block Main [OB1] we call the block "Filling_level_tank1 [FC1].
Otherwise, the block would not be processed at all. A double click on Main [OB1] opens this block (
Main [OB1])





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 30 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

17. With drag&drop, the block "Filling_level_tank1 [FC1] is then simply moved to Network 1 of
the block Main [OB1]. Remember to document the networks also in the block Main [OB1] (
Filling_level_tank1 [FC1])





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 31 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

18. Next, the input variables as well as the output variable are wired in OB1 with the PLC variables
shown here. By clicking on the project is stored ( "AI_level_tank1
"Tank1_max "Tank1_min )





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 32 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

19. To load your entire program into the CPU, first highlight the folder Control_tank and then click
on the symbol Load into device ( Control_tank )





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 33 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

20. In case you forgot to specify the PG/PC interface beforehand (refer to Module M1, Chapter 4), a
window is displayed were this can still be done ( PG/PC interface for loading Load)




Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 34 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

21. Click on 'Load once more. During loading, the status is displayed in a window ( Load)



22. A window displays that loading was successful. Now click on Finish ( Finish)



Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 35 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

23. Next, start the CPU by clicking on the symbol . ( )





24. Confirm the question whether you actually want to start the CPU with OK ( OK)





Industry Automation and Drive Technologies - SCE


TIA Training Manual Page 36 of 36 Module
M5
Status: 06/2010 Analog Value Processing at the SIMATIC S7-1200 with TIA Portal V10

25. By clicking on the symbol Monitoring on/off, it is possible to monitor the status of the
variables while testing the program ( Filling_level_tank1[FC1] )

Вам также может понравиться