S7 Training

Page 1

SIEMENS

SIMATIC S7- COURSE

PAS-SIEMENS PAKISTAN


SIMATIC Hands On

Contents 1 Introduction 1.1 1.2 1.3 1.4 1.5 1.6

PLC: The way of operation STEP 7 Programming Language Comparison of Wired Control / PLC Basic Elements of Digital Program Programming Program processing

2 Programmers 2.1 2.2

PG 720, Starting S7 menues

3 Automation System SIMATIC S7, AS - 300 3.1 3.2

General Programmable Logic Controller AS S7-300

4 The first programming exercise with STEP 7 4.1 4.2 4.3

Operator Interface Programming Exercise Exercise

5 Programming in "LAD" & FBD 5.1 5.2

Ladder diagram - LAD Function Block Design - FBD

6 Symbolic Addressing 6.1 6.2

General Example with FC

7 Load and Transfer 7.1 7.2 7.3

General Direct Addressing Memory-indirect Addressing

Training-Center of the portfolio Industrial Projects and Technical Services (PAS )

i-1


SIMATIC Hands On 8 Memories, Timers, Counters, Comparators 8.1 8.2 8.3 8.4 8.5

Memories Timers Counters Comparators Exercise

9 Data Blocks 9.1 9.2 9.3 9.4

General Global data blocks Instance data blocks Exercise

10 Information Functions 10.1

Overview over all information functions

11 Practical Exercise 11.1 11.2

Shutter-control, Exercise Traffic - light, Exerc.7

Training-Center of the portfolio Industrial Projects and Technical Services (PAS )

i-2


SIMATIC Hands On

1

Introduction

1.1 PLC : The Way of Operation (Automation System) Central Processing Unit (CPU)

Inputs

Reading the Process Images of the Inputs

Processing the Control Program

Outputs

Outputting the Process Images of the Inputs

Programmer

A SIMATIC S7 programmable controller consists of the following components: - Central Processing Unit (CPU) - Buffer battery for the data security in the RAM - S7 bus - Digital inputs - Digital outputs The CPU comprises a memory (containing the user program) and the control unit (processing the user program).

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-1


SIMATIC Hands On 1.1.1

Control Unit

According to the control program, the control unit calls up the statements in the program memory one after the other and executes them. While doing so the information from the process image of the inputs are processed. The results are written to the process image of the outputs.

1.1.2

Memory

The program is written to the CPU memory by means of a programmer. The following program memories are available: On the CPU: RAM -

EPROM

Plug-in modules: RAM EPROM EEPROM

1.1.3

= = =

Random Access Memory (Read- / write memory) Erasable Programmable Read Only Memory Protected against unintentional erasing Stores the CPU operating system

= = =

To extend memory capacity Read memory, UV-erasable Electrical Erasable Programmable Read Only Memory Read memory, electrically erasable

Cycle Time

After a single program processing: Reading the PII Processing the user program Outputting the PIQ

( = Process Image of the Inputs) ( = Process Image of the Outputs)

the processing starts from the beginning, i.e. the program is cyclically processed. The duration of one program cycle is called cycle time. The cycle time depends on the processing time of all statements in a program. It is monitored by the CPU. At the start of each program cycle, the monitoring time ( app. 150 ms ) is started. If the cycle has not been completed within this monitoring time ( due to a programming error or a CPU fault ) the programmable controller enters the STOP state and all outputs are switched off.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-2


SIMATIC Hands On 1.2 STEP 7 Programming Language STEP7 is the programming language for user programs of the SIMATIC S7 programmable controllers. Programs can be represented either as Statement Lists (STL), or as Control Signal Flow (CSF), or as Ladder Diagrams (LAD). The control statement is the smallest part of a STEP 7 program. It consists of operation and operand:

- Operation: Description of the function which is to be processed: "what is to be done?" e.g. "A" for an AND logic operation - Operand: The operand consists of identifier and parameter - Identifier "what is it to be done with?" e.g. "I" for Input - Parameter "in which place it is to be done?" e.g. "6.7". for byte. and bitaddress

CONTROL STATEMENT OPERAND OPERATION IDENTIFIER

PARAMETER Byte and bit address

A

I

6.7

AND

INPUT

6.7 i:training.ctr\Kursordn\S7bas\As300\Zeichngn\chap1\2_Anweisung.dsf_Adr

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-3


SIMATIC Hands On 1.2.1

Types of representation

For programming there are available three different types of display. Statementlist STL A A ON = BE

I I I Q

0.0 0.1 0.2 8.0

Control Signal Flow CSF I 0.0

Ladder Diagram LAD

&

I 0.0

I 0.1

Q 8.0

≼1

I 0.1 I 0.2

=

Q 8.0

I 0.2

STL is the pure listing of a program. It requires of the programmer the capability to memorize abstract expressions for a longer period, to insert it again later. The advantage is the easy way of program-alternations. Remark: In contrast to STEP 5 the spaces between operation and operand must be written. CSF and LAD are modes to create programs graphically, but there are some restictions in programming in opposite to STL. Programming-elements in CSF or LAD are to be copied into the program out of a catalogue.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-4


SIMATIC Hands On 1.3

Comparison wired control / PLC.

While statements can be processed simultaneously in wired relay arrangement, this is absolutely impossible in a AS program. Example:

electromechanical switches: Ι 0.0

Ι 0.1

PLC:

Q 8.0

Q 8.1

A I 0.0 = Q 8.0 A I 0.1 = Q 8.1 BE

I 0.0 Q 8.0 I 0.1 Q 8.1

T

i:training.ctr\Kursordn\S7bas\As300\Zeichngn\chap1\3_Relais_SPS.dsf_Adr

Time range necessary to process one statement. This range is very short but not as short as you like.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-5


SIMATIC Hands On 1.4

Basic elements of digital programs.

A program - written either in STL or LAD - is translated to a statement sequence by the programmer. This statement sequence is then stored as MC7 machine code in the user memory of the programmable controller. An MC7 statement is represented by a 16-, 32 or 64-bit information. A BIT is the smallest piece of information which can be represented, either with value ‘0’ or value ‘1’. In STEP7 there are also the Tetrade, called "Nibble" as well (4 Bit), the BYTE (8 bit), the WORD (16 bit) and the DOUBLE WORD (32 bit). Bit: 0/1

Byte: Value:

state `0´ or `1´

128

64

32

16

8

4

2

1

7

6

5

4

3

2

1

0

0

1

0

1

0

1

0

1

Bit:

Tetrade

Tetrade

Word: Value: 32768

8192

2048

16384 Bit: 15 0

4096

512 1024

128

64

32

16

8

4

2

1

256

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

Left Byte More significant byte

2

Right Byte Less significant byte 8 ( because 2 0 > 2 )

8

20

Double Word: e.g. Flag Double Word FD14 Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 0

1

0 1 0

1

Byte 14

0 1

0

1

0 1

0

Byte 15

More significant word

1

0 1 0

1

0 1

0

1

Byte 16

0 1

7 6

5

0

0 1

1

4

3 2

1 0

0

0 1

1

Byte 17

Less significant word

i:training.ctr\Kursordn\S7bas\As300\Zeichngn\chap1\4_Relais_SPS.dsf_Adr

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-6


SIMATIC Hands On 1.5 Programming 1.5.1

Linear Programming Start OB 1 1st instruction 2nd instruction

Linear programming is only possible in organisation block OB1. OB1 is cyclically processed, i.e.: after the last instruction the first instruction is processed again. In case of linear programming every cycle takes the same time, since every instruction, whether it is processed or not,requires its processing time.

.............

last instruction

i:training.ctr\Kursordn\S7bas\As300\Chp1\5_LinearPrg.dsf_Adr

1.5.2

Structured Programming

OB 1

FB n

FB n

FB n

with memory

:BE

without memory

:BE

:BE

DB n

FC n

DB n

FC x

FC n

:BE

:BE

:BE

DB n

i:training.ctr\Kursordn\S7bas\As300\Chp1\6_StruktProgr.dsf_Adr

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-7


SIMATIC Hands On 1.5.3

Blocks

To arrange a complex program more clearly, it can be divided into separate program parts, each representing a certain technological unit. Thus testing and commissioning will be simplified. For this purpose different blocks are programmed. Generally one can make a distinction between blocks containing signal-processing statements (organisation blocks, function blocks and functions) and blocks for storing data ( data blocks ): - Organisation blocks (OB) serve for the user program management in cyclically controlled, interrupt-controlled or time-controlled program processing. They contain the sequence of the blocks to be called and processed. - Functions (FC) contain the user program, arranged according to technological units. Functions serve for structuring. - Function blocks (FB) contain user programs just as FCs . Unlike an FC, an FB requires a so-called ‘INSTANCE DB’ as intermediate storage for parameters and local data which should not get lost. - System functions (SFC) are pre-programmed blocks integrated into the CPU. They can be used by the user. - Data blocks (DB) contain the data the user program works with, e.g. intermediate results from calculations or fault information. - System data blocks (SDB) contain data concerning the CPU operating mode Various tools use the SDBs to store default data. Every block that is called may call a further block. When a called block has been completed, the program automatically returns to the starting point ( i.e. to the point after the call instruction ). Data blocks are an exception: They represent data areas which can be accessed via a call instruction.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-8


SIMATIC Hands On 1.6 Program processing When a block is to be processed, it must be called (Unconditional Call UC, Call). If the called block has been processed, the program is continued at the point of the block call, i.e. in the calling block. Block jumps within structured programming have the advantage of considerably shorter cycle times: If a block is not to be processed, its processing time can be omitted. Only the actually processed instructions have an influence on the cycle time. So the duration of a program differs depending on the number of blocks that have been called. In linear programming, OB 1 is processed immediately if no other block has been programmed. So no block calls are necessary here. The BE operation (block end) indicates the end of a block. This operation may be unconditional (BEU) or conditional (BEC). Remark: If You need, the comfortable Programmer's "HELP" can be used: Example: Additional informations concerning the operation "BE": trigger the button with questionmark via mouseclick and release the mousekey

? Help

-

shift it to the wanted operation select:"Statement List Language Representation" select:"Program Control Instructions" select."BE"

The user program can be processed in three different ways: -

cyclic interrupt-controlled time-controlled

With programmable logic controllers cyclic program processing is the rule, although interrupt- or time-controlled program processing may be inserted between two program blocks.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-9


SIMATIC Hands On 1.6.1

Cyclic Program Processing

OPERATING SYSTEM UPDATE Process image of the inputs ( PII)

START Cycle time

OB 1 CALL FC 1

FC 1 CALL FC 2

BE BE

Output Process image of the outputs (PIQ) to PERIPHERY i:training.ctr\Kursordn\S7bas\As300\Zeichngn\chap1\7_ZyklusProgr.dsf_Adr

OB1 serves for the cyclic program processing. OB1 suitably contains only unconditional block calls. The individual program blocks are processed in the sequence of the calls. When the last instruction of OB 1 has been processed, the next processing cycle starts. During program processing input or output modules are not accessed. This information has been stored in the process images of inputs and outputs.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-10


SIMATIC Hands On 1.6.2

Process images

Before the start of the cyclic program, the condition of the inputs at the I/O-modules is transferred to the process image of the inputs. This prevents signal changes which occur during a program cycle from having disturbing influences.

Process image of the inputs (PII) Bit 7 65 43 21 0 Byte 0 1 2 3 4 5

0 0 0 0 1 1

0 0 0 0 1 1

0 0 0 0 1 1

0 0 0 0 1 1

1 0 0 0 1 1

0 0 0 0 1 1

0 0 0 0 1 1

Input module I/O-byte 0 0 0 0 1 0 0 0 0

0 0 0 0 1 1

127 1 1 1 1 1 1 1 1

I I I I I I I I

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7

i:training.ctr\Kursordn\S7bas\As300\Zeichngn\chap1\7_PAE.dsf_Adr

There are input modules with 8, 16 and 32 inputs. Inputs are addressed in bytes (0 - 255) in steps of 1, 2 or 4 bytes. i.e., only the initial address of the module is set. There are 128 I/O-bytes with process image (0 - 127) and 128 without process image for analoge values (128 - 255). Every byte has 8 inputs, addressed from .0 to .7, thus inputs are addressed as follows: e.g: And A A A e.t.c. .... up to A

Input I I I

Zero 0 0 0

Dot . . .

Zero 0 1 2

I

127

.

7

The first byte is always set as module address.

e.g.:

Byte

0 = Module address 1 2 3

4 = Module address 5 6 7 i:training.ctr\Kursordn\S7bas\As300\Zeichngn\chap1\9_Baugrpadr.dsf_Adr

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-11


SIMATIC Hands On After the user program has been processed, the process image of the outputs is sent with the outputs set by the program. e.g.

OB 1 A I 0.3 = Q 8.6 BE

Process image of the outputs (PIQ) Bit 7 Byte 4 0 5 0 6 0 7 0 8 0 9 0 127

6 0 0 0 0 1 0

5 0 0 0 0 0 0

4 0 0 0 0 0 0

3 0 0 0 0 0 0

2 0 0 0 0 0 0

1 0 0 0 0 0 0

0 0 0 0 0 0 0

Output module I/O-byte 8 0 0 0 0 0 0 1 0

A A A A A A A A

4.0 4.1 4.2 4.3 4.4 4.5 8.6 4.7

0 00 00 00 0

i:training.ctr\Kursordn\S7bas\As300\Zeichngn\chap1\10_PAA.dsf_Adr

During processing only the process images are worked with (with the exception of load and transfer operations which address the I/Os directly. ) After the processing of OB1 the process image of the outputs is sent to the I/Os. The addressing of the output modules corresponds to the addressing of the input modules.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 1-12


SIMATIC Hands On

2

Programmers

2.1 SIMATIC FIELD PG Programmers of later series use WINDOWS 98 and are equipped according to the edition with a pentium processor and frequency 700. In contrast to PC's from the market the PG's are provided with interfaces for EPROM, Flash-Eprom, PCMCIA, MPI, monitor and mouse and have a floppydrive.

2.1.1Starting via SIMATIC Manager: -

"SIMATIC Manager" icon doubleclick

7 Adr

At this point you will see whether there's an authorization for operating S7 programs in the programmer or not. If the authorization is missing , the following message is screened:

-

2.1.2

"No authorization found". The application will be closed" "OK" click Copy authorization from the red disk as described in section 2.2.1. via SIMATIC Manager you will get to the following window (V4.01):

Starting STEP 7 menues

"OFFLINE": Creating and documenting programs on floppy disk or hard disk without connection to the PLC (CPU, PLC). "ONLINE": When programmer and PLC are connected, programs may be created, checked and corrected. When working online, consider that changes may have far reaching consequences: In the worst case, a single key stroke may lead to hazardous effects.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 2-1


SIMATIC Hands On

From this point, programs may be created, copied, monitored (TEST STATUS) and modified on-line as well as off-line.The meaning of the different softkeys will be indicated by the programmer itself, if You move the cursor near to the concerned key. Now the programmer-PLC connection might be established.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 2-2


SIMATIC Hands On

3

Automation System SIMATIC S7 3.1 General

SIMATIC S7-200 : The SIMATIC S7-200 is optimally suited to open loop and close loop control tasks in mechanical engineering and plant building. The S7-200 acheives its full performance potential in distributed automation solutions. Application areas include, Ø Balling presses Ø Plaster and Cement mixers Ø Suction Plants Ø Wood working machinery Ø Gate controls Ø Hydraulic lifts Ø Conveyor systems Ø Food and Drinks industry SIMATIC S7-300 : The SIMATIC S7-300 is a modular mini PLC system for low end applications for a wide variety of tasks. A wide range of individually combinable modules is available for expansion. Various CPUs wiyh increasing levels of performance and a comprehensive range of I/O modules with many convenient funtions allow the user to choose only those modules required foe particular applications. Application areas include, Ø Special purpose machines Ø Textile machines Ø Packaging machines Ø Control System Ø Machine Tools Ø Installation Engineering. SIMATIC S7-400 : The SIMATIC S7-400 is the power PLC for applications in the medium and upper performance ranges. Modular, fan-free design, ruggedness and capacity for easy expansion, extensive communication capabilities, easy implementation of distributed structures make the SIMATIC S7-400 the ideal solution for even the most demanding tasks in the medium and upper performance ranges. Application areas include, Ø Automotive construction Ø Warehouse equipments Ø Machine tool construction Ø Process Engineering Ø Control and Instrumentation equipments Ø Special purpose machines Detailed description of SIMATIC S7-300 is given below for being the main topic of the course.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 3-1


SIMATIC Hands On

3.2

Programmable Logic Controller ‘AS’ S7 - 300

3.2.1 The Components of the AS

PLC S7 - 300 with 2 DIs (2-word) and 2DQs (2-word) Signalling-LED

Signalling-LED

EPROM-module slot

BATF SF DC5V FRCE RUN STOP

SM 321 DI 16xDC24V

SM 321 DI 16xDC24V

SM 322 DO16xDC24V/0,5A

SM 322 DO16xDC24V/0,5A

RUN-P RUN STOP MRES SIMATIC S7 - 300

CPU

Input modules

Output modules

Key switch Cover for the power supply connector, buffer battery compartment and MPI-interface

Universal Rack "UR"

i:training.ctr\kursordn\s7bas\as300\Zeichngn\chap3\1_AS300.dsf_Adr

The AS S7 - 300 consists of -

Module rack, called Universal Rack „UR“ , - available in different lengths from 160 to 2000 mm - serves for mounting all modules

-

Power supply (not in this figure), must be mounted to the left of the CPU - for mains operation; necessary, if no DC 24V is available for the CPU. The PS supplies the AS with the necessary extra low voltage. - available in three versions: 230,120V / 24V: 2A, 5A, 10A

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 3-2


SIMATIC Hands On -

CPU (Central Processing Unit), The CPU processes the control program. In case of a power failure, the memory contents are saved by the buffer battery in the battery compartment. The control program may be stored on a memory module (EPROM). The mode selector switch on the CPU is designed as a key switch. It can be pulled only in ‘RUN’ or in ‘STOP’ mode. This is only a low level protection against unauthorized activities, as the key is a mass product. A password makes better protection for the CPU possible. The CPU has an MPI-interface, to which a programmer can be connected. The following CPU versions are available: 312 IFM, 313, 314, 315, 315-2DP. Specific information is provided by the individual manuals.

-

I/O-modules - these are input, output and special modules. Signal transducers, relays and others are connected to the I/Os. The modules can perform a data interchange via S7 bus. Note: The plug at the I/Os’ backplane serves for bus communication only. Signal transducers and other consumers in the plant are supplied with power via front connectors only. 3.2.2 CPU Overall Reset

An ‘overall reset’ is performed, if the entire user program stored in the RAM is to be erased ( so when beginning a new programming ).

Case a: Case b:

Key switch „STOP“ „MRES“ , hold app. 1 sec until LED „STOP“ lights again, then at once (!!): „STOP“ , then again at once : „MRES“ "STOP" flashes for app. 3 sec and has steady light then: CPU has been overall reset. "STOP" does not flash, or other indicators (except „BAF“) are flashing: Repeat overall reset.

What happens in the CPU during overall reset ?: 1. User program in user memory and load memory are erased 2. BACKUP memory is erased 3. Hardware test 4. Initialisation of hardware and system program parameters 5. If an EPROM is inserted: its contents are copied to the load memory What remains unerased after overall reset ?: 1. Contents of the diagnostics buffer 2. MPI interface parameters (MPI = Multi Point Interface) 3. System diagnostics parameter

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 3-3


SIMATIC Hands On The MPI interface is suitable for establishing connections between CPU and programmer and - within a network - also between several CPUs. The AS-net may have up to 127 nodes, the node numbers being definitely assigned: PG =0 „Operation-Panel“ OP =1 CPUs = 2....following The node numbers may be changed in the ‘S7 Configuration’ menu. The cable length between CPUs may not exceed 50m, it can however be extended up to 1 km by using 2 RS 485 Repeaters.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 3-4


SIMATIC Hands On

The first programming exercise with STEP 7 4.1 Operator Interface Comparable to the PLC software, many are familiar to, the STEP 7 software is also provided with "WINDOWS", files, nodes and buttons, integrated into the menu bars of the windows which trigger certain PG functions. Here you see a STEP 7 selection:

i

New Projekt

Open Project

Accessible Nodes

S7-Memory-Card

cut-out

Copy

? Online

Offline

Help

Print

Download

Upload

Catalog i:training.ctr\kursordn\s7bas\as300\Zeichngn\chap4\1_Bedienele.dsf_Adr

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-1


SIMATIC Hands On OB Organisation block - a code block An OB starts its program on its own, not depending on the call of another block. OB1 is responsible for the cyclic program part, i.e. for recurrent program processing. Other OBs are intended for specific tasks: Timed interrupts, interrupts (event-triggered Alarm OBs, which call certain program parts), trouble-shooting (OBs, which are called only in case of certain faults). Cycle time is the time range the PLC needs to process one complete program cycle, starting with the beginning of OB1 and finishing with the end of OB1. The currently required cycle time may also be scanned "ONLINE". "ONLINE" means: the PG is permanently connected to the PLC and thus makes it possible to monitor the process. How this works cannot be tested until we run a program in the PLC. The cycle time required for one program cycle is monitored and lasts for an average of 150 ms. However, it is possible to modify the cycle monitoring time within the limits 1...6000 ms. Steel industries and power station operators need very small cycle times - concrete industries ( slowly turning tube ovens ) prefer a comfortable setting of various product types rather than rapid cycle times. When the cycle time has been exceeded, the CPU goes to STOP. FC - "FUNCTION" - a code block The FC is an easily programmable block which will contain our program. It has the following properties: -

contains the program has no assigned memory area temporary data are lost when this block has been processed

4.2.1 Opening a new project The project name for this exercise is: TC_ERL doubleclick

7

Ad r

Simatic Manager

click New Projekt

click Ad r

New File

"New File" appears in the working field. The input at "Filename" relates to that new folder.

"Open"

delete the * in the file description. at "Filename" write: TC_ERL save click

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-2


SIMATIC Hands On the following window appears (V 4.01):

Explanation of the buttons in the upper line: The meaning of the other buttons has been described in the beginning.The programmer also indicates the function if the cursor is moved to the lower edge of the respective button.

End of application Close window Window to Full Screen Size Iconize Window

To insert hardware into the new project will be the next step: Insert Station „SIMATIC-300-Station“

SIMATIC 300-Station1

click, in the pull-down menu click click in the right window the symbol for SIMATIC-300Station is added doubleclick

Adr

RU N-P RU N STOP M RES RU N IM AT IC ST SOP

doubleclick - leads to the window:

S7 M RES- 300 SIM AT IC S7 - 300

TC_ERL\SIMATIC 300-Station1 - Hardware Configuration:

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-3


SIMATIC Hands On 4.2.2

Configuring Hardware

Now one should know which CPU and which modules are actually available. In our case the data can be seen from the labelling of the modules. click leads to the "Hardware Catalog" - window Catalog

SIMATIC 300 Rack - 300 Mounting Rail"

doubleclick - leads to selection of components available for AS 300 doubleclick doubleclick - leads to the window below:

According to the description, the first slot is reserved for a powersupply. therefore a CPU can be inserted into slot 2 only: Slot 2 + 0 CPU 300

click - leads to the blue marking in the line at slot 2 click - leads to the selection list of all available CPUs read from the device: CPU xxx, Ordernumber...., if correct: doubleclick

A second possible method is "DRAG&DROP". A device is to be selected and pulled into the wanted position during the mousekey is kept in ON. By this mode, the PG indicates instantly, if a certain modulecard can be inserted Into a slot or not: .

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-4


SIMATIC Hands On 4.2.3 Parameterizing the CPU -

"CPU 314"

doubleclick leads to the following window:

-

the designation offered by the programmer may be adapted

If the is CPU parameterization is to be modified later, this mask must be called, beginning in the "TC_ERL - <Offline> [Projekt]" window: -

CPU314[ ] click Edit Object Properties

At this point the cycle time mentioned above might be set: Remark: -

Try the "Help" key in the present window ! "Cycle / Clock Memory" click Cycle monitoring time may be set between 1...and 6000 ms Proposal for the exercise tasks: 150 ms. A minimum cycle time for CPU 314 is not planned The specification "Cycle Load from Communication [%] " is only important if the AS is connected to a bus system. The RAM self test loads the cycle time. Entry "0" disables the self test.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-5


SIMATIC Hands On The pulse byte modifies its value 0-1 in symmetric amplitudes. If a memory byte is to be used, it must be entered and activated here. Then of course the memory byte is assigned in the further program and is not available for other purposes. Proposal for the exercises: Flag byte 1 In the "Properties" - window the MPI address ("Multi-Point-Interface") may be modified. This is important, if more than one AS are connected via MPI net. INPUT and OUTPUT modules are also required for operating an AS: With SIMATIC S7 digital modules are called "SM" - modules ("Signal-Modules"). As before in the case of CPU and Rack you start with to get into the Hardware-catalog Catalog

+ +

"SM - 300"

"DI 300"

Slot 4 SM 321 DI 16xDC24V Please compare the displayed order codes with the one on the module ! If both order codes do correspond, it must be the correct module. Addresses with AS 300 are not freely selectable. They are depending on the respective slot

click - leads to the selection table of all available I/O modules. Our training device comprises 2 input modules (DI) and 2 output modules (DQ). click - leads to the selection table of all digital input modules. The selection is according to the labelling of the modules inserted into the AS. Slot 3 is reserved for an interface module to other AS's (e.g. CPU with PROFIBUS-DP-Interface). click click - leads to the following window:

This procedure will be repeated for the second input module on slot 5. Then deselect "DI" and select "DQ" and assign the two output modules to slots 6 and 7. Catalog

close

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-6


SIMATIC Hands On The configuration of the training device is completed now and should look like the picture below (except the MPI-address).

click A dr

Save and Compile

At this point you may have a printout of the configuration, if a printer is available. Information on how to connect a printer to the programmer is available in a section before. click Print

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-7


SIMATIC Hands On 4.2.4

Adjust the MPI-Interface

Remark: Modules of System S7, containing MPI-Interface are delivered from factory always with MPI-Interface=2. If it is necassary to add another MPI-capable module, e.g. a Coprocessor and the CPU already is addressed with MPI=2, first has to be changed the MPI-Address of the added module. Therefore its helpful, to program also the 1st module, usual the CPU with a MPI-Address unequal 2. To change the address do as follows: - CPU switch to STOP - connect PG and AS - open project via manager - open configuration-table of the station - take card "Genaral" - select "Subnet" - select address, e.g. 3 - confirm input - store and close - download Transferring the configuration to the CPU Overall reset of the AS - as described before click Download

guides to the illustration opposite

Remark: As long as Data have not been tranferred completely, the old MPI-Interface still is valid. Therefore the old node-address is shown as long as the datatransfer lasts but, after the transmission via "properties" the new MPI-node number must be shown.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-8


SIMATIC Hands On The configuration you set up is to be copied now to the selected MPI address. The following message is displayed: "Module Currently Beeing Processed" „Download“ click Message: "Order Number of Module to / from which to Download / Upload" and a display indicating how far the load process has been processed. Your training device has now been completely configured and is ready for the input of code blocks. Now the "TC_ERL\SIMATIC 300-Station1 - Hardware Configuration" window may be closed.

4.2.4 Addresssing signal modules As notified in chapter 3, signalmodules can be addressed free if there is used a CPU S7 315-2DP (not CPU S7 314!) and can be adapted to the process: -

select module on slot 5 right mousekey click object properties click guides to window "properties" - DI16xDC24V - [R0/S5] select "Addresses" delete the hook at System-Default (not possible with CPU 314) exchange the "Start"- address into "2"

The same way the addresses of signalmodules in slot 6 and 7 can be changed into address 4 and 6. Now addresses IW0, IW2, QW4, QW6 are valid for further programming. If the addresses are kept, think about it, when operating the next programs.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-9


SIMATIC Hands On 4.2.6

Editing a code block

4.2.6.1 General The most simple kind of blocks in S7-System is the "Function", in the programs shortened as "FC". FC's contain program of single or multiple used Automatisation-tasks. FC's can be parameterized and put out at the end a return-value ("RET_VAL"). This RET_VAL is an operation-value which must not but can be parametized. He is being assigned at the end of a block and can contain all elementary parameter-types as well as "DATE_AND_TIME", "STRING" and "UDT". Not defined are "ARRAY", and "STRUCT". The explanation of the single parameters shall be done in a later chapter. Besides the operation-value FC's can contain other outputparameters. FC's do not store informations. also they don't have any own Datablock. 4.2.6.2 Finding the suitable window Creating the new code block FC 10. Switch off the programmer if necessary and begin as follows: doubleclick

7 Adr

click leads to the "Open Project" window „TC_ERL“ +

doubleclick leads to the "TC_ERL - <Offline> [Project]" form

+

click

+

click

+

click

S7-Programm[2]

+

click

Bausteine

+

click

TC_ERL

+

SIMATIC 300-Station1 Adr

+

+

+

CPU 314

S7

at this symbol

doubleclick

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-10


SIMATIC Hands On

4.2.6.3 Creating the FC - file: "Insert" click "S7 Block" click "Function" click "Properties" Fill in as shown beside: For "Author" fill in Your own name.

leads to the window

Confirmation with returns into Simatic-Manager

FC 10

doubleclick - leads to window: "FC10 - <Offline> Ladder Logic / Statement List : Programming S7 Blocks“ click window resized to full screen size

Adr

the same for the "FC10 - <Offline>" window

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-11


SIMATIC Hands On 4.2.7 Programming FC10: 4.2.7.1 Brief description of the block Instead of the question marks comments may be inserted: FC10 : ??? click text may now be entered into the displayed box, e.g.: function "FC", with SIMATIC S7 Segment 1: ??? click e.g.: simple bit-operation Below "Segment 1" there is an empty area. Click into this area and a white box will be opened. Here You can enter all statements. In the case of being grey, the field is prepared for documentation-input, but not for statements. Using unconditional call "Declarations" may remain untouched. To get more place for programming, the separation-line can be moved up via mouse-operation.

simple bit-operation

click (it is advisable to save the block now and then !) A dr

Save and Compile

In the following the expression "Carriage-return" ( abbreviation: "CR" ) is used. "Carriagereturn" is a remainder from the time of mechanical type writers. It was used to start a new line. The keyboard sign is:

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-12


SIMATIC Hands On 4.2.7.2 Editing the actual program Remark: The spaces between operation and operand must be entered manually. Each Statement must be closed with ↾. FC 10:

Function "FC 10" with SIMATIC S7

Segment 1 : simple bit-operation A A AN O = BE

I 1.0 I 1.1 I 1.2 I 1.3 Q 9.0

A dr

.

Save and Compile

and print, if necessary Print

4.2.7.3 Creating OB1 "Insert" "S7 Block" "Organisation Block" "Properties" window: Internal ID: Language: Name: Family: Author: "OK"

OB1 STL CycProg Exerc_TC [Your Name]

OB 1

OB 1 contains for program simply the call of FC 10. The indicated declarations remain unnoticed. OB1 : cycelstart Segment 1 : Start of cyclic program UC BE

FC 10

Adr

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-13


SIMATIC Hands On The programmed blocks exist as file in the PG-memory. May be, You like later to check or change properties of a block, do as follows: - file - properties - properties block

4.2.8

Downloading the program into the CPU

To enable the CPU to process the program, FC 10 and OB1 must be downloaded into the CPU. Note the position of the CPU key switch. Downloading is only possible if the key switch positions are "STOP" or "RUN-P". By the way, the key cannot be removed in "RUN-P" - position. That means, if the keys is removed exists a weak protection against unauthorized online-operations. A weak protection, because the key is a lot times available. More efficient protections will be discussed later. Start-conditions is the open block, which shall be downloaded:

Download

"OK" "NO". "YES"

Here appears a warning: If You transfer blocks in "RUN-P"-mode, the CPU can go into STOP Reasons for that will be explaint within the warning click - there'll be a message, if You want to download the block into the AS - to cancel the procedure - to start the download. The block is being downloaded into the CPU.

Ad r

Adr

activate several times to close all windows down to the "TC_ERL - <Offline> [Project]" window Activate to reduce the window in size again. Otherwise iconise or close the window.

If more than one single block is to be downloaded it's faster be done in the SimaticManager-window. In this case open both windows Online and Offline, collect the blocks You want (click on and hold shift-key 単 ) and shift using the mouse from one window into the other. Switch the CPU into "RUN" or "RUN-P" - mode and test Your program, using the simulator.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-14


SIMATIC Hands On 4.3

Exercise

Write the circuit described as S7 STL program. Especially note the rule: AND before OR may be written without bracket, which saves performance. OR before AND must be separated by a bracket. a) Program the block using absolute addressing. Call it from OB1 with "UC". b) Program the block, using the contact-declarations as symbolic addressing. Call from OB1 with "CALL". Try other inputs/outputs as before. Function: Name: Family: Author:

FC 12, Task_1 Exerc_TC [Your Name]

Concerning exercise 1:

C: \des igne r\s 7_zc hng\ s7gr u4_ 8.dr w_Ad r

The relation of the contacts is as follows: Q1 I 4.0

Q2 I 4.1

Q3 I 4.2

Q4 I 4.3

Q5 I 4.4

Q6 I 4.5

K1 Q 12.0

K2 Q 12.1

After programming, transfer the program to the PLC and test it by means of the PG. The program is :

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 4-15


SIMATIC Hands On

5

Programming in "LAD" and "FBD". 5.1 Ladder-diagram - LAD.

We had a look at some blocks in "STL", now we will have an example in "LAD". "LAD" is programmed with the following symbols:

Adr

Adr

Adr

Adr

Adr

Adr

Adr

New Network Program Elements Normally Open Contact [F2] Normally Closed Contact [F3] Output Coil [F4] Open Branch [F8] Close Branch [F9]

Overview over the program to be programmed: FC13 : ??? Network 1

:

I5.0

I5.1

I5.4

I5.5

I5.0

I5.1

Network 2

I5.2

Ladder Diagram Exercise I5.2

I5.6 I5.5

:

Q13.0

I5.3

I5.6

I5.7 I5.7

Postprocessing of the network1 results

Q13.0

Q13.1

Assigning the properties of the new block

Window

Properties Block: Language Name Family Author

FC 13 KOP Expl_3 Exerc_TC [....]

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 5-1


SIMATIC Hands On 5.1.1

Designing the structure

Proceed with the FC 13 program: The first form appears in the following figure. Set the cursor beside "Network1". Write the comment there as suggested or as you like. Move cursor downwards and select the program part. The cursor indicates the first possible site for entering an operation: Select operation, e.g: "AND It is automatically inserted into the circuit. Slide with the cursor to the neighbour position and click to it: The green marking moves to the new site. To select the operation proceed as done before with "AND". Proceed with various operations until you have programmed a circuit as displayed in the beginning of this chapter. How to change something: Set the cursor to the operation to be removed. The green marking indicates the element to be erased. Delete the element with the PG "Delete" key ( "DEL" with english or "Entf" with german keyboard's inscriptions ).

5.1.2

Adding operands to operations

If all elements have been programmed, the operands ( "I x.y" ) must be entered. To do so, set the cursor to the question marks above the respective operation and enter the relevant operand. After the input of the first operand it is easily to be continued, using the CR-key ↾ . The curser then goes automatically from operand to operand. Then the statements must be declared. As all of them are bits, only declarations of the "bool" type are entered there.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 5-2


SIMATIC Hands On Transfer the program to the PLC and test it. Green solid lines indicate flowing current, dashed green lines indicate that no current is flowing. Please do not forget that every block of the cyclic program must be called by OB1.

5.1.3

Block modifications

Open FC 13 off-line. Insert memories (flags), outputs and a new network according to the figure below. The outputs must be supplemented in the declaration, the memories needn't. Flags are also called "connectors" in STEP 7. Remember: In S5 these were the interprocessor communications flags. The flag symbol - (#) - is intended for assignment and scanning at once. Later this memory will be scanned only.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 5-3


SIMATIC Hands On

To create network

a

Midline Output

new To select further Functions, eg.: Flags

Memorybits are scanned

This flag was selected for timerflag, It's blinking.

Don't forget to adjust OB1. If you keep the sequence SDB - FC10....FC13 - OB1 when transferring to the CPU, you won't receive the error message. Especially note the clock memory: The flashing frequency of Q13.3 is varying: M1.0 is the highest frequency, M 1.7 the lowest. M 1.7 M 1.6 M 1.5 2" 1.6" 1"

M 1.4 M 1.3 M 1.2 M 1.1 M 1.0 0,8" 0,5" 0,4" 0,2" 0,1"

If there is no flashing, You might have forgotten to adjust it when presetting the CPU. You can catch it up now: Programming offline - CPU in STOP - transfer.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 5-4


SIMATIC Hands On 5.2 Function Block Design - FBD 5.2.1

General

Programs, created via "Function Block Design", with Step 7 possible since update 3.1, use graphical symbols in a rectangle-form, which show on their left and right side inputs and outputs. The processed function is displayed within th rectangle. The preset of test mode of display is preselected by "Options - ..." or already when creating the Block the first time. There are some statements, as e.g. "BE", which cannot be displayed via FBD. Therefore FB 10 from the first example cannot be displayed without any restrictions via FBD.

5.2.2

A program in FBD

Before FC10 from the first exercise can be displayed via FBD, "BE" has to be shifted into another network. Our small program, extended by a "Midline Output" M0.1 looks as shown beside. The most common elements are displayed as hotkeys in the upper line. If other functions are required, they are to be selected from the submenu "Program elements". In our case it was M 0.1. It is beeing assigned and at once scanned again, but it would be possible to scan it another time in another network or program.

How to insert further elements. Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 5-5


SIMATIC Hands On Either the cursor is taken to the desired place within the network, the element is selected and transferred by doubleclick or using the "drag & drop"-mode the element is selected by one click and dragged to the desired place in the design during the mousekey is beeing kept pressed. Hereafter may be added further elements as: Add more inputs

negate inputs

multiplictate outputs

click the gate

??.?

& and

and

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 5-6


SIMATIC Hands On

6

Symbolic Addressing

6.1 General An advantage of the S7 automation system compared to the S5 is the possibility of programming directly with symbolic addresses. Thus the preceding examples can also be programmed with symbolic operands directly instead of absolute operands (e.g. I 0.0) .

6.2

Example with FC Block: Name: Family: Author:

FC 24

STL Examp_15 Exerc_TC n.n. Operand

absolute I 0.0 I 0.1 I 0.2 I 0.3 Q 8.0

formal coffee milk shugar stir coffee_milk_shugar_stirred

then FC 24 looks as follows: Address 0.0 0.1 0.2 0.2 2.0

Decl. in in in in out

Symbol coffee milk shugar stir coffee_milk_shugar_stirred

Data Type BOOL BOOL BOOL BOOL BOOL

Initial Value TRUE TRUE TRUE TRUE TRUE

Comment

FC 24 : Example 15, Exerc_TC Network 1 : function with symbolic addressing A A A A = BE

#coffee #milk #shugar #stir #coffee_milk_shugar_stirred

//Declarations

24 signs

A comment beside a statement always starts with 2 slashes "//".

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 6-1


SIMATIC Hands On The corresponding OB1 must be programmed as follows: OB 1 : ??? Network 1 : ??? CALL FC 24 coffee milk shugar stir coffee_milk_sugar_stirred BE

here the absolute operands are to be inserted

:=I0.0 :=I0.1 :=I0.2 :=I0.3 :=Q8.0

6.3 Exercise A fan assembly consisting of 3 fans is installed in 3 different rooms. If less than 2 fans are in operation, a message shall be output. The timer (proposal: T15, T16, T17) is called "Delay" and the time value "Duration". Program the necessary data blocks (proposal: no. 14,15,16), a function block FB 14 containing the function, and an FB 15 which calls FB 14. Use the terms of the diagram as symbols. Fan 1

= 1

Fan 2 Delay

Fan 3

& Release

S_EVERZ

M es s age buf er f A c know ledgeR m ent

Duration Fan 1 Fan 2 Fan 3

S

&

>1 Fault

Release c:\designer\s7_zchng\s7gr8_1.drw_Adr

Then test your circuit with the device. Remark: The first gate is an Exclusive-Or, EXOR ( also called "1-from-n-selection", here with n=3 ). The EXOR from the catalogue is to be used only with 2 inputs (S7-software V 4.01). For more than 2 inputs, it must be created by ANDs and ORs.

Function:

EXOR

OR

c:\designer\s7_zchng\s7gr8_2.drw_Adr

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 6-2


SIMATIC Hands On

The "table of truth" lists the different reactions of both gates:

I 0.0

I 0.1

I 0.2

Q 8.0

Q 8.1

0 0 0 0 1 1 1 1

0 0 1 1 0 0 1 1

0 1 0 1 0 1 0 1

0 1 1 0 1 0 0 0

0 1 1 1 1 1 1 1

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 6-3


SIMATIC Hands On

7

Load and transfer

7.1 General The previous Operations AND, OR, =, e.t.c are used to process Databits. Bytes, Words, Doublewords, Timervalues, Countervalues e.t.c are to be operated only by "LOAD" and "TRANSFER". These Operations scan and process registers of the AS. In "Status" are displayed two registers, called "STANDARD" (ACCU1) and "ACCU2". In opposite to S5, S7 knows different ways of addressing: - direct - memory-indirect For Operands can be used an programmed: Integer Byte 32 - Bit - Integer-Constant 8 - Bit - Hexadecimal-Constant 16 - Bit - Hexadecimal-Constant 32 - Bit - Hexadecimal-Constant 16 - Bit - Binary-const. 32 - Bit - Binary-const. 2 Characters 4 Characters Timer-constant Counter-constant Floatingpoint-number Pointer Date Clock Time of Day

L L L L L L L L L L L L L L L L L L L L

+5 -5 B#(7,12) B#(3,14,7,12) L#2 B#16#AD W#16#CAFE DW#16#BADEBAFF 2#1111001100110101 2#11110011001101011111001100110101 'AD' 'TCER' S5TIME#2S C#20 1.0E+5 P#E1.0 1) P##Fault D#1997-11-11 T#0D_1H_1M_0S_0MS TOD#11:11:11.11

1)

The declaration "Fault" must be defined first in the list of declarations of the block, before it can be used for a Pointer.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 7-1


SIMATIC Hands On 7.2 Direct addressing Most of Load- and transfer-operations concern Standard (ACCU1) and ACCU2. Loading:

The contents of the specified operand are written to ACCU 1 (STANDARD). The contents of "STANDARD" are written to the address specified by the operand.

Transferring:

With a further "LOAD" operation the contents of "STANDARD" are automatically transferred to ACCU 2. In case of another "LOAD" operation the ACCU-contents are transferred again, the value of the first "LOAD" operation gets lost, however. Write FC 22, in "STL", Expl_10, according to the figure below and monitor it in "STATUS".

RLO STA

STANDARD

ACCU2

W#16#1 W#16#2 W#16#3

0 0 0

0 0 0

1 2 3

? 1 2

IW 0 QW 8 IW 4 QW 12

0 0 0 0

0 0 0 0

1234 1234 5678 5678

3 3 1234 1234

W#16#CAFE FW 4

0 0 0

0 0 0 0

cafe cafe cafe

5678 5678 5678

Network 1 : ??? L L L

D D

Network 2 : ??? L T L T Network 3 : ??? L T BE

The program of Network 2 can be used easily to test inputs, e.g. the simulator.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 7-2


SIMATIC Hands On Legal declarations for operands are: I IB Byte IW Word Doubleword ID

Q

PI

PQ

M

DB

DI

L

Parameters from 0...bis

QB QW QD

PIB PIW PID

PQB PQW PQD

MB MW MD

DBB DBW DBD

DIB DIW DID

LB LW LD

65 535 65 534 65 532

Meaning of abbreviations: I Q PI PQ

Input Output Periphery-Input Periphery-Output

M DB DI L

Memory (Flag) Datablock Instancedateblock Lokaldata

7.3 Memory-indirect addressing Parameters can be put "direct" to the Operand as well as "indirect" into a Word or Doubleword. Than they are changeable by program. This way of programming is not to be used with symbolic operands. Indirect addressable Inputs Outputs Flags Localdata Timers 1) Counters 1) Datablocks 1) Functions 1) Functionblocks 1) 1)

Access via Bit Byte Word Doubleword

Examples A I [MD 22] L IB [MD 22] L IW [MD 22] L ID [MD 22] L T [MW 20] L C [MW 20] L DB [MW 20] L FC [MW 20] L FB [MW 20]

here the address must be put onto a Word

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 7-3


SIMATIC Hands On

8

Memories, Timers, Counters 8.1 Memories

Circuit arrangements require memory modules as memories. They are called "FLIPFLOP" or - in semiconductor technologies - "bistable multivibrator" ( not common with S7 ). In the beginning we pointed out that an SPS cannot process instructions simultaneously. In order to have flipflops with priority at one's disposal, two different flipflop types are available: SR-FF i.e.: Set - Reset - Flipflop RS-FF i.e.: Reset - Set - Flipflop Example 5: Program the following circuit, transfer it into the PLC and test it: -

FC14 Expl_5 Exerc_TC

LAD

M 10.0

M 10.1

SR_FF S R

RS_FF Q

R

Q

S

0

0

?

?

0

1

0

1

1

0

1

0

1

1

0

1

? means: memory remains as it was, condition not known

Status Test displays both variants as shown in the figure below (see also A 6_1): Remark: Netzwerk and Operands E, A, (German) are Network, I, Q, (English)

R 端 c k s ehas tzen Reset hat priority Vorrang

S e t zhas en Set hat priority Vorrang

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-1


SIMATIC Hands On 8.2 TIMER There are various types of timers. SIMATIC S5 programmers know the following timers: S_IMP S_VIMP S_EVERZ S_SEVERZ S-AVERZ

Pulse Latching pulse ON delay Latching ON delay OFF delay

8.2.1 Value representation with time values: A time value is the value a timer needs to supply an output signal. It is represented in "BCD": 1 Tetrade

100 th

10 th

1 th

0 0 0 1 0 0 1 0 0 1 1 0 1 0 1 0 Timebase

Timevalue in BCD (Binary Coded Decimal) s7bas6_2.drw_Adr

BCD basic rule:

Value per tetrad ≥ 0 Value per tetrad ≥ 9

The time base may be modified within the ranges: value binary

dec.

00 01 10 11

0 1 2 3

time intervals upon error in timer time processing generation [sec] ±[sec] 1/100 1/10 1 10

1/100 1/10 1 10

maxima [sec]

=[min]

=[h]

9,99 99,9 1,665 999 16,65 9990 199,5 2,775

The value respresented in the bitpattern-figure above is 265/10 sec or 26.5 sec. According to the selected time the S7 system automatically sets the time base. Representation of the time value input: is automatically converted to: 20 sec 254 sec 3789 sec

s5T#20s S5t#254s s5t#3789

S5T#4M14S S5T#1H3M

time base is [sec]:

1/10 1 10

You can enter capital letters and small letters as well. Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-2


SIMATIC Hands On 8.2.2

Programming a pulse timer

The diagram represented below shows the reaction of a pulse timer. The time is started with "S", immediately switching output "Q" to "1". If the input is equal to the set time "T" or exceeds it, "Q" is "0" again after "T" has expired. If "S" is "0" before "T" has expired, "Q" is also "0" again. "R" ( "reset" ) cancels the runtime. The timer cannot start again, as an edge evaluation is necessary for starting a timer. set "S"

1 t

reset "R"

1 t

output"Q"

1

T

T

T

t c:\des igner\s7_zchng\s7gru6_3.drw_Adr

What does "edge evaluation" mean ? Edge evaluation is the scan of a signal state change. This may be a 0 -> 1 change or vice versa. The timers SP, SE, SR, SS require a positive edge change ( 0 ->1 ), SS requires a negative edge change (1 -> 0). What is edge evaluation needed for ? If RLO = 1 was sufficient to start a timer, timers with T > maximum cycle time could not run. Timers would be restartet after each cycle. Program an FC16 in LAD Name: Bsp_6, Family: Exerc_TC, Author:..... You will find the timers in A dr

Pr ogr a m Elements

and then "Timer":

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-3


SIMATIC Hands On Neither the used flag nor the two output words must be declared: FC 16 Beisp_6 [Name]

Exerc_TC

No declarations necessary Network 1

Timer behaviour, here 'Pulse'

T0 I 4.0

M 2.3

S_IMPULS S

I 4.1

S5T#3789S

TW R

Q DUAL DEZ

QW 8 QW 12

Observe the input of the time value ! Immediately after confirming with CR, the input [s] is converted into : S5T#1H3M. The time grid is 10 sec here. The long duration has been selected to offer you the opportunity to monitor the difference between binary representation (QW8) and decimal representation (QW12) . Transfer the block into the PLC and program a new OB1. This is necessary, because the input and output facilities of the simulator are insufficient to process the signals of all examples. The following figure displays the respective "Status" :

Dual, Dual, meant gemeintis ist Hexadecimal HEXADEZIMAL I 4.0

QW 8 I 4.1 QW 12

Dezimal, gemeint Decimal, meant is BCD ist BCD BCD

A great advantage of BCD is the fact, that the remaining time can be read without being converted. This would be 3760 sec in the example above ( first 3 digits: time grid = 10sec, the following 3 digits: time = 376). The binary representation does not specify the time grid. Therefore the binary representation must be recalculated according to the example below:

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-4


SIMATIC Hands On 2

1

0

1 x 16 + 7 x 16 + 8 x 16 = 256 + 112 + 8 = 376

8.2.3 Other timers Now modify the extraordinary long time to 5 to 10 sec. approximately. Insert 5 additional networks into FC16. Parameterize as follows: T0 T1 T2 T3 T4

S_IMP S_VIMP S_EVERZ S_SEVERZ S-AVERZ

with with with with with

I 4.0, I 4.1, Q 8.0, BIN: FW 4, DEC: FW 6 I 4.2, I 4.3, Q 8.1, BIN: FW 8, DEC: FW 10 I 4.4, I 4.5, Q 8.2 BIN: FW12, DEC: FW 14 I 4.6, I 4.7, Q 8.3 BIN: FW16, DEC: FW 18 I 5.0, I 5.1, Q 8.4 BIN: FW20, DEC: FW 22

In this case again no declaration is necessary. Transfer the modified block into the PLC and monitor the different behaviour of the timers at the outputs.

8.2.4 A timer application With the following circuit you can generate pulses to trigger a timer, e.g.:

FC 17 Beisp_7 [Name]

Exerc_TC

No declarations necessary Network 1

I 4.0

Generating a pulse for a single cycle M 2.0

I 4.0

I 4.0

M 2.0

M 2.1

S5T#2S

T0 S_EVERZ S Q

M 2.0

DEZ

1 etc

M 2.1 1 T0 1

TW DUAL R

1

QW 12

T

t

For reasons of explanation the diagram contains the processing times for instructions ( which normally are very short ). Memory (Flag) 2.1 has been inserted as explanation only and need not be programmed.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-5


SIMATIC Hands On "Status Test" frozen status:

kann nicht cannot bebeobachtet watched, PG - PG zu langsam iswerden too low

I 4.0

Funktion sichtbar Function is to be seen

I 4.0 QW 12

8.2.5 Exercise Program a circuit with timers to generate a regular frequency as displayed in the figure below: -

FC18 Task_2 Exerc_TC [Name]

LAD

I 4.1 t Q 8.1 2sec

2sec

2sec

2sec

2sec

2sec

2sec

t

c:\designer\s7_zchng\s7gru6_8.drw _Adr

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-6


SIMATIC Hands On 8.3 Counter 8.3.1

General

Counter tasks are processed with counter functions by the CPU directly. Counters are available for -

Counting up Counting down Counting up and down

Z_UP Z_DOWN COUNTER

The counting area ranges from 0 ....... 999. Thus it is not possible to count < 0 or > +999 . Like timers, counters are counted up via edge change 0 -> 1. Timers may be reset via a special input. Important: Counter output Q is only "0", if the counter really is set to "0". The count-value (BCD!) is an OFFSET to set the counter to a certain value. From this value the counter is counted either up or down.: OFFSET, e.g.: 20

count up

coun t down

1

Pulse

1

2

3

4

5

6

7

8

9

10

11 12

13 1 4 15 16

17 18 19 20

21 2 2

23

24

1

Output Q

24

Output words DUAL or DEC

1

c:\designer\s7_zchng\s7gru6_9.drw _Adr

8.3.2 Example To test the various counters, program an -

FC 19 Expl_8 Exerc_TC [Name]

LAD

with 3 networks: Network

C...

Type

1 2 3

C0 C1 C2

C-UP C-DOWN COUNTER

CU I 4.0 I 4.2

Inputs CD S I 4.6 I 4.1 I 4.6 I 4.3 I 4.6

Countvalue

R I 4.7 I 4.7 I 4.7

C#10 C#20 C#30

Outputs Q DUAL Q12.0 FW4 Q12.1 FW8 Q12.2 FW12

DEC FW6 FW10 FW8

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-7


SIMATIC Hands On Counters can be found like connectors and timers in the catalogue:

A dr

Pr ogr a m Elements

select Count Up

In "Status" you can monitor the function as displayed below: I 4.2 is "1", the counter however has stopped as there has been no edge change. The countdown of the offset of 30 was started. The outputs are "1C" binary ( HEXADECIMAL! ), or "28" BCD. Q12.2 is "1“ because the counter output is > 0.

Counter C2 I 4.2

Q 12.2 CU

I 4.3 CD I 4.6

CV I 4.7

QW 8

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-8


SIMATIC Hands On 8.3.3 Exercise Write a program to realize a 1/7 pulse frequency, i.e. every 7 input pulses the output is to signal. You need a counter to count up, an input contact for counting, an input contact for resetting and some contacts according to your needs. Hint: It is possible to evaluate the counter output bits separately: -

FC 20 Task_3 Exerc_TC [Name]

Setting proposal:

C3 I8.0 I8.1 Q9.0 MW14 MW12

LAD

Counter up counts resets supplies output signal supplies binary output (Memoryword) can be read from the simulator

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-9


SIMATIC Hands On 8.4 Comparators Before dealing with comparators, let us extend our knowledge concerning the values used in SIMATIC.

8.4.1

Programming Comparators

The SIMATIC S7 can compare "16 bit integers" (words), "32 bit integers" (double words) and "32 bit reals" (float point numbers). As an introduction we will have a look at "words" only. You willl find the comparators - like timers and counters etc. - in the catalog:

The following comparisons are possible: equal

not equal

larger than

smaller than

=

><

>

<

larger than or equal >=

smaller than or equal <=

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-10


SIMATIC Hands On Generally the first input is compared with the second input

e.g.:IW0

(word, double word),

e.g.:IW4

(word, double word).

If the comparison has been met, the comparator output is "1". In our example below the comparison has been met, thus Q8.5 has signal "1". I0.4 12288 IW0 16384 IW4

CM P <=I

Q8.5

IN1 IN2 c:\designer\s7_zchng\s7gr6_12.drw _Adr

Now test the individual comparators by programming an FC 21 comprising all the possible comparators in 6 networks. Make use of the "copy" and "paste" buttons when programming several networks of a kind. If you have inserted and connected an incorrect comparator by mistake, you can modify it using the "Insert" key of the programmer. Mind the status line, the bottom line of the programmer: The "insert" mode changes to "overwrite" mode.

Exercise with different comparators

buttons and Buttonscopy „kopieren“ paste und „einfügen“

the message hier erscheint displayed here o.g. Meldung

is

Insert

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-11


SIMATIC Hands On Besides "INTEGER" also Doublewords and Realnumbers can be compared: CMP <>D L#40000

CMP <R 3.400000e+000

IN 1

L#-222222

IN 1

2.200000e+000

IN 2

IN 2

8.5 Exercise 4 Write an FC23, Name: Aufg_4, according to the block diagram below. The timer generates pulses for a counter. The counter shall be monitored at output word 8 in "BCD". In addition the DEC-counter-output is routed to a comparator. There it is compared to a value to be set a IW0. If the counter value is >= the preset value, the comparator sets a SR-FF. The comparator outputs a signal to Q13.0. Output Q13.0 is gated to the counter's input pulses in a way that a "1" signal initiates a counting down and signal "0" a counting up. The zero point switchover is realised by counter output "Q" at SR-FF. IW0 QW8

I4.0

2 sec

Switch

COUNTER

CMP

SR-FF

Q13.0

c:\designer\ s7_zchng\s7gr6_13.drw _Adr

If the circuit has been properly programmed, the counter with I4.0 set continuously counts between 0 and the value set at IW0.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 8-12


SIMATIC Hands on

9

Datablocks 9.1 General

Further, in S7-System used blocks are Function- and datablocks. Functionblocks - "FB". The call of FB is to be paremeterized via blockparameters. In opposite to FC's, FB's do have a store for variables which is situated in the DB attached to the FB. It's possible to attach DB's, so called "Instance-DB's" with similar structure but different parameters to each call of a single FB. Another expression for the combined call of FB + DB is "Instance". FB's are able to memorize data not only into their own Instance-DB. That's possible as well in the Instance-DB of the calling FB'. This is named "Localinstance". Datablocks - "DB". Code blocks assign the so-called "Local data area" in the RAM. These "temporary" data get lost when the respective block has been processed. If data are to be stored in the CPU-memory for further use, however, data blocks are required. Data is stored there in the form of bitpattern, bytes, words, doublewords e.t.c.. Data of "global" DB's can be processed by FC and FB and Instance-DB, which are belonging to a single FB. Data blocks do not contain program, their length depends on the CPU: with CPU 314 it can be up to 8 kbyte. 1)

"Global DB" "Instance-DB" which may be accessed by all other FC, FB. which are exclusively assigned to a FB For Data are reserved some dummies in form of variables, datatypes with presetting. If a datablock is used only to store data, it can be created als by using "ARRAY". Several FB access one global DB

Instance-DB's take the structure of data from the assigned Functionblock. Therefore it is necessary to program the FB before the Instance-DB is created. One FB accesses several "Instance" DBs

c:\designer\s7_zchng\s7gr7_2.drw_Adr

c:\designer\s7_zchng\s7gr7_1.drw_Adr

1

)

3

In the decimal system 1 kilo represents 1000, the base is 10 , then 10 = 1.000. 10 In the binary system 1 kilo represents 1024, the base is 2, then 2 = 1024. Then 8 kbyte aren't 8000 byte but 8 x 1024 = 8192 byte.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 9-1


SIMATIC Hands on 9.2 Global data blocks Open SIMATIC Manager as usual and insert a DB 10 as displayed in the figure below:

you proceed into the following window from S7 manager and doubleclick on the DB: Here is to be selected, which type of block shall be configured

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 9-2


SIMATIC Hands on We select the "data block" type, if we wish to specify its structure by entering data elements on our own. This DB may be used by all code blocks. You may insert the name according to your needs. The type must correspond to the data type used. It can be either selected via "Insert - Data Type" - Elementary Types or - other types or - entered via keyboard

Hit Proceed with Hit Hit

↵ ↵ ↵ ↵

to proceed to the next line. There you can either preset an initial value or S7 System automatically enters a value, here e.g.: W (word)#16(number of bits) #0 (preset). again; now you can enter comments. again; a new line is opened where further data words can be enterd.

You can also copy input lines as described in chapter 4. The data word addresses ( known as data word numbers in S5 ) are automatically assigned by the system. Anyone having programmed S5 will notice that no odd data word addresses are available in S7. Save to programmer and transfer to PLC. Remark: A Datablockword "DBW" 4 consists of 2 Datablockbytes "DBB" 4 and "DBB" 5.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 9-3


SIMATIC Hands on 9.2.1

Corresponding test program

Enter the following FB to test the DB you have just programmed:

-

FB 10 Examp_12 Exerc_TC [Name]

-

STL

New statements: -

"AUF DB 10" calls global data block 10. From now on all inputs referring to data words are valid for the called DB.

-

"L DBW 0": The contents of data word 0 are loaded to "STANDARD".

-

"T DBW 8": The contents of "STANDARD" are transferred to DW 8.

-

"T DBB 4": The contents of "STANDARD“ are stored in data byte 4, the "HIGHBYTE" of DW4.

-

"JC" is a conditional jump. It is only processed if the RLO ( = result of logic operation ) = 1.

-

A jump label must start with a letter and end with a colon. A statement must follow immediately. Jump labels may consist of explaining text ("a:", "zero"). This text is converted to "M001, M002,........" on status calls.

-

"BEU" means "Block End Unconditional", i.e.: the processing of this block is cancelled at this point without any precondition.

-

"BE" is the final block end. With "LAD" it is generated automatically.

-

"NOP 0" means: "No Operation 0", no operation. It has been inserted to keep the program more clearly but it doesn't contain any statement. A simple blank line - as known in S5 - is not allowed in S7.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 9-4


SIMATIC Hands on An FB with global data block is called as follows:

(„Unconditional Call“)

OB1 : Network 1 : other call of FB with global DB! UC FB 10 BE

The following operations are helpful to get more information to the status display or to mask out undesired columns: Options Customize

On the following page you will find FB10. Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 9-5


SIMATIC Hands On

10

Information functions

10.1 Overview over all information functions

Chapter Information function

10.2

CPU data

10.3

CPU messages

10.4 10.5 10.6 10.7

10.8 10.9

10.10

Information version, capacity, possible outputs

Purpose

memory reading number of data inputs and

CPU

typical

display of error messages user memory current setting before transferring programs to the CPU cycle times duration of the longest, controlling shortest and last cycle blocks block list, valid for the when setting up a user selected CPU program communication Communication number of the possible capabilities and or assigned on-line performance data of the connections. CPU AS time system time base, correction display and setting of factor, date and time of date and time the respective CPU reading the diagnostics display of the evaluation of the buffer diagnostics buffer, reasons for STOP and processing blocks if the for other events relative address is given stacks I-, B-, L-stack display detecting the reason for the CPU STOP displaying the operation state

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-1


SIMATIC Hands On 10.2 CPU Data To open the information function of the connected CPU: open project as shown in the figure:

Proceed with - "Edit" - "Properties" The selection window displayed beside appears: The other windows are displayed here:

Further windows give information about protection-level and alarms.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-2


SIMATIC Hands On 10.3 CPU messages The called FB 12 of the previous example was deleted in the CPU to trigger a message. FB 13 now calls a block which has not been loaded. The resulting CPU-messages can be read as follows: -

On-line

Remark: Please note, that "S7 programs[..]" is selected. Otherwise the following operations are not enabled: View CPU-messages leads to the following form CPU message configure In this form the amount of messages to be collected in the archive (20 ≤ amount ≤ 1000) can be specified. The "Angemeldete Baugruppen" window lists all modules that have been configured. This is a single CPU in our training device. Messages can be received if the the so-called control boxes are marked with a tick mark ( ü ) sind. 20 ≤ number of messages ≤ 1000 - are stored in the archive - "delete" removes a CPU from the list mode: - Foreground: message display + archiving - Background: message display in the background window + archiving - Ignore : messages are neither displayed nor archived Remark: Old messages can be deleted from the display if the CPU is deleted in the window displayed above. A re-selection of the CPU is only possible with a new call of the "SIMATIC Manager".

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-3


SIMATIC Hands On You should update the CPU clock before reading the messages: - Zielsystem - Uhrzeit stellen - OK

Execute a cold restart now: Initial window is "SIMATIC Manager" again: - Zielsystem - Betriebszustand - Neustart Call - "CPU-Melden konfigurieren". On the bottom of the screen - "CPU Melden" is displayed as softkey again Activate this softkey. The messages are raised in the window displayed. The configuration ( Selection of the CPUs which output messages ) can be selected and modified via the first softkey.

Both other softkeys display the contents of the archives.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-4


SIMATIC Hands On 10.4 User memory The initial window is the same as displayed below "PLC" Select - „Module Information“ now in the pull-down menu.

The window opposite contains general data for the selected CPU

- "Memory" displays the memory utilization of the selected CPU. Sometimes, if memory is complete, at this window it's possible, to - "Compress" to get new spare-memory. Compress deletes unvalid blocks in the RAM and adds valid nes blocks without gaps. Unvalid blocks are produced when changing blocks. Then ,valid blocks are turned into unvalid and new blocks are added to the memory-end. - "Update" adapts the representation of the process ( "frozen conditions" ) to the running process.

10.5 Cycle time - "Cycle time" to read the parameterized minimum and maximum cycle time. In addition there is information about the - shortest - current - longest cycle time of the present program.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-5


SIMATIC Hands On Remark: As already mentioned, input words, output words and I/O words are not the same. While hardware modules represent the periphery itself, input word and output word are the image of the I/Os, which is frozen while the program is processed and updated after completing or before beginning the cyclic program. In the following example the outputs are to be put out without OB1 being processed. Thus you have to manage the update on your own: This will be necessry in the loop in the following program, if ouput Q 13.1 is to be monitored. Write the following program: Block: FC Name: Family: Author:

25 Examp_16 Exerc_TC [...]

STL

Declarations: none FC 25 Network 1 :

loop:

AN BEC A L SP A R A = = L T A JC BE

extension of cycletime by program I

5.1

I IW T I T T Q F QB PAB F loop

5.0 0 26 5.7 26 26 13.1 2.0 13 13 2.0

Now set the various times for the pulse timer via IW0, e.g.: Time [ms] 4th Tetrade 3rd Tetrade 2nd Tetrade 0000 0000 0000 0 50 0000 0000 0000 140 0000 0000 0001 0000 0000 0001 150

1st Tetrade 0000 0101 0100 0101

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-6


SIMATIC Hands On Please note the modified information in - Module Information - Cycle time

Remark: -

At a time of 150 ms the CPU goes to STOP Execute a cold restart of the PLC and hit the "Update" key to make the modifications visible in the graphic.

10.6 Blocks - "Blocks" displayes all integrated blocks of the selected CPU. This concerns OB's and SFC's. The available user blocks are not displayed in detail, however. Only information concerning full configuration is displayed, e.g.: Type OB FC FB DB SFC SFB

Quantitiy 13 128 128 127 36 0

max. length 63 kB 63 kB 63 kB 63 kB

10.7 Communication - "Communication" This window displays information concerning the baud rate, possible and used communication connections and the configured load of the CPU.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-7


SIMATIC Hands On 10.8 Time system - "Scan Cycle-Time" makes it possible to read out

- current time - resolution, - clock format and - synchronization with other nodes.

The Correction Factor helps to set a clock which is too fast or too slow.

Setting the Correction Factor Select "SC" in the SIMATIC Manager.

Select the CPU in the hardware configuration which is raised then - Edit - Properties A further window is raised: Set the Correction-Factor there. - Save Now the internal CPU clock has been adjusted as required.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-8


SIMATIC Hands On 10.9 Stacks and diagnotic buffer 10.9.1 Stacks Faults and their reasons are displayed in so-called stacks. You can access the window only if the PLC is in STOP. This is easy with example 16: Set a time > cycle time for the pulse timer and trigger I 5.0.

Selecting Stacks leads to the window displayed opposite: From here you can open the secondary block directly without opening other windows. It is advisable to have a look at the I-Stack first in order to learn more about the cause of the error ( refer to next figure ).

From here you can open the block only once. A further attempt results in the message "Server ausgelastet". In this case a selection is only possible via the softkey now available in the bottom line of the programmer. The selected faulty block is displayed. I-Stack and L-Stack look as follows:

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-9


SIMATIC Hands On 10.9.2 Diagnostic buffer You will find further information in the "Diagnostics buffer" window. This diagnostics buffer is a cyclic buffer, i.e. messages coming in will overwrite the oldest messages, if the cyclic buffer is full. The capacity of the cyclic buffer depends on the CPU, with CPU 314 it is limited to 100 events. CPU-internal "SFC" ( "system functions" ) are used for trouble-shooting or diagnostics.

Message no. 1 caused the STOP. A detailed errordescription is listed in the box. If a relative address is given, the faulty block can be opened via "Open Block" key.

Probably the fault specification is correct. The PLC must crash within the program loop as the cycle time has been exceeded intentionally.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-10


SIMATIC Hands On 10.10 Operating Mode Often programmers are located separated from the CPU. Thus reading the Operating Mode from the PLC is not possible. The "Operating Mode" information solves this problem.“ To read the "Operating Mode" proceed as follows, starting from -

SIMATIC Manager: PLC Operating Mode

Here it is also possible to switch the PLC to STOP or to RUN manually. You can either perform a Restart or a Complete Restart.

Complete Restart: Operates OB 100. Resets all outputs, timers, counters and flags to 0. A cold restart processes start-up Restart: Operates OB 101 Switches off the output to the I/Os until a new program cycle starts, OB 101.

Remark for for S5 experts: OB100 (S7) ↔ OB101 (S7) ↔

OB 20 or OB 21 with PLC 115U OB 21 the former OB 22 (warm restart after mains failure) is not available with S7.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-11


SIMATIC Hands On 10.11 Reference lists If you have to modify programs, it is necessary to know which inputs, outputs, flags etc. have already been assigned and therefore cannot be used. For this purpose various lists can be used - however, only in off-line mode at the moment. Proceed as follows: -

SIMATIC Manager call OB 1, for instance, Options Reference data leading to the question: "The Program has been changed. Update?" Yes

The cross reference list is displayed. According to your needs you can select free operands, missing identifiers and filters via softkeys. The respresentation of the cross reference list may be reduced to the necessary information my means of filters. Select or deselect: - for the lines: Inputs, outputs, flags, counters, timers, Dbs, PII, PIQ - for the colums: Symbol, operand, block, details. You can save the selection via "save standard...". Thus the selection need not be specified anew if the reference data is called again.

Cross-Refernce List Programstructure

Filter Addresses without symbols unused addresses

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 10-12


SIMATIC Hands On

11

Exercise

11.1 Blind-control Task 6 Program in LAD or STL a blind-control: - 2 blinds of a building are to be operated manually up and down - the blind-function is to be indicated by a flash-lamp - On the upper as well on the lower level each blind-drive is to be switched off by endswitches. - with strong sunshine (fotodetector) both blinds shall be closed automatically to keep Blind lef t temperature low within the S 6. 3 S 5. 3 building. Fotodetec tor - the manual control has S 0 priority to the sun-automatic. - to keep the blinds save if strength of the wind is high, S 1 they have to be rised up into K 5. 1 K 5. 2 their casings. This protectioninterlock has priority to the S 5. 4 S 6. 4 manual control s tandby

is c los ed

running

is open

s tandby

is c los ed

Hand / A u tom .

Em ergenc y Of f

Clos e

Open

running

is open

Hand / A u tom .

Em ergenc y Of f

Clos e

Open

Blind r ight

S tr e ngh of the wind

K 6. 1

K 6. 2

m gx des igner\10_1ds . 4_A dr

For this task You can program FC 31 and FC 32. Assignment of devices, operands and their meaning: Switch Key Relais Operand left

right

Q4

left

right

left

right

Q0 Q2

Q1 Q3

I 4.0 I 4.1 I 0.0 I 0.1 I 0.2 Q 8.7 Q 8.6

I 5.0 I 5.1 I 1.0 I 1.1 I 1.2 Q 9.7 Q 9.6

EMERGENCY-OFF EMERGENCY-OFF unlock, standby switch operation by Hand / Automatik strength of the wind ≥ max. strength of sun ≥ max. blind in operation standby

Q 5.1

Q 6.1

I 4.2 I 0.3 Q 8.0 Q 8.1

I 5.2 I 1.3 Q 9.0 Q 9.1

key command by hand „UP“ endswitch „upper level“ motorcontrol „UP“ blind "is open"

I 4.3 I 0.4 Q 8.4 Q 8.5

I 4.4 I 1.4 Q 9.4 Q 9.5

key command by hand „DOWN“ endswitch „lower level“ motorcontrol „DOWN“ blind "is closed"

Q5 S0 S1

S 5.3

S 6.3 K 5.1

Q 5.2 S 5.4

K 6.1

Q 6.2

S 6.4 K 5.2

K 6.2

left

Purpose

right

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 11-1


SIMATIC Hands On 11.2 Traffic-light 11.2.1 General Task 7: For this exercise there is available a traffic-light-simulator. It consists of 4 traffic-lights for pedestrians and 4 traffic-lights for motorized-traffic:

gn am rd

rd

gn

rd gn

rd am gn

direction A gn gn am rd

rd

gn

rd

rd am gn

direction B

keys

connections

ON - feedback

24 V powersuppl.

ON/OFF preselect

Inputs 50-pol. D-Sub

outputs direction

A Flashing/Normal

I 0.0

Automatic/Manual

I 0.1

change of direction

I 0.2

Outputs 50-pol. D-Sub

Auto. rd am gn Ped. rd gn

B Q 8.5 Q 8.6 Q 8.7 Q 8.4 Q 8.3

Q Q Q Q Q

9.5 9.6 9.7 9.4 9.3

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 11-2


SIMATIC Hands On The trafficlight shall switch the phases green 25 sec, amber (before red) 10 sec, red 25 sec and amber+red (before green) 3 sec. As long as the automatic is switched off, the traffic-light shall indicate amber flashlight in 2 sec-pulse. There are crossroads, which cannot easily be operated by a traffic-light. For better control during the rush-hour there is a policeman busy to switch the different directions according to the traffic. For this is meant manual operation. Using manual operation, it shall be possible to switch over from one direction to another. But it must be excludet that waiting-times are shortened unwillingly. DB 17 contains the bitpattern for switching the lamps. DW

Hexadec

Bitpattern

Direction A Ped.

Auto

0 2 4 6 8 10 12 14

0000 7030 8830 5030 3070 3088 3050

0000 0111 1000 0101 0011 0011 0011

0000 0000 1000 0000 0000 0000 0000

0000 0011 0011 0011 0111 1000 0101

0000 0000 0000 0000 0000 1000 0000

am+rd gn am rd rd rd

rd gn rd rd rd rd

Auto

B Ped.

rd rd rd am+rd gn am

rd rd rd rd gn rd

Structure: OB1

start of the cyclic program FC 26

creates 2s-pulses and switches the amber lamps or operates the automatic-program FC 27

transferres sequentially the bitpattern to the lamps and operates the prepared time-delays FC 28

3 s time-delay,

operates stepcounter +1

FC 30

25 s time-delay,

operates stepcounter +1

FC 29

10 s time-delay,

operates stepcounter +1

FC 28 FC 30 FC 29

repeated calls of the required timers

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 11-3


SIMATIC Hands On 11.2.2

Task 7.1

In "OFF-Condition" the traffic-light shall show amber flashlight: I 0.0 Position not NORM NORM

11.2.3

Status

1

I 0.1 Position not AUTO

AUTO

Status

0

I 0.2 Position MAN MAN A B

Status

0 or 1

Task 7.2

The traffic-light shall release or block both directions automatically. I 0.0 Position not NORM NORM

Status

0

I 0.1 Position not AUTO

AUTO

Status

1

I 0.2 Position MAN MAN A B

Status

0 or 1

Hint to FC 27: In a flagword, e.g.: FW 2 will be stored the certain programnumber which operates the required bitpattern just in time. Scanning for „=1“ operates a jump to a jumpmark, e.g.: "A". In this part of the program bitpattern Hex=7030 will be outputted and 3 sec waitingtime will be triggered. FW 2 is counted up +1 in the waiting-time-block. For the next phase FW 2 and scan for "=2" triggers a jump to the next jumpmark, e.g.: "B". There will be outputted bitpattern Hex=8830 and triggered the next waiting-time. FW 2 again is counted up for +1 in the waiting-block. e.t.c....

11.2.4

Task 7.3

Within mode "NORM" shall also be processed manual switch-over: I 0.0 Position not NORM NORM not NORM NORM

Status

0 0

I 0.1 Position not AUTO not AUTO

Status

AUTO

0

AUTO

0

I 0.2 Position MAN MAN A B MAN MAN B A

Status

0 1

The program remains in red- or green-position until I 0.2 triggers a new change of release of directions. It must be strictly impossible to skip waiting-times, also directions are changed manually.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 11-4


SIMATIC Hands on

12 Connecting the Periphery 12.1 General Profibus means as well the connection among different AS's as the connection of extension-units. Remark: If AS's are to be connected via Profibus (SINEC L2), all other stations keep on running, also if one of them is in STOP. Not so with Profibus-DP! Here is to be operated a grid via buscable, but if the AS fails, all the rest is out of service! In the following chapter an ET 200 M shall be connected to AS 315 DP.

12.2 Configuration of the devices:

Bus-interface

Address-switch

To connect AS 315 DP to IM 315, the ET 200 M with powersupply, IM 153 and small simulator buscable of the so called profibussystem is to be used. In each plug PS 307 2A there is a resistor 50â„Ś, which has simpy to be switched on at every end of a line. To extend by further stations, normally will be mounted another cable parallel within the plug. In the practical training there are doubleplugs in use. Then it's possible to 307 - 1AB00 - 0AA0 extend the grid by attatching another plug to the rear side of the plug, Powersupply Interface small simulator which is already plugged into the DP-Interface. 315 - 2AF01 - 0AB0

374 - 2XH01 - 0AA0

ET 200 M.\Hardware dsf_Adr

12.3 Configuration of the hardware 12.3.1 To configure theCPU Insert a new CPU, using the SIMATIC-Manager as done before, or change the existing CPU. The MPI-address remains 3. The pulse-memory shall be put to MB 1, if not done before already.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 12-1


SIMATIC Hands on 12.3.2 Configure the DP-interface. This time in "hardwareconfiguration" the DP-Master - interface of the CPU also will be programmed. - DP-Master - Object Properties - Profibus-Address: select 2 - 1,5 Mbit/s - Hook into area "The node is connected to the selected network" - "Properties": here it's possible to insert the programmer's name. - "Network Settings" here are to be adjusted bus-parameters - Take over by "OK".

12.3.3 Connect DP-Bus - select DP-Master - insert -"DP-mastersystem" it appears within the window a path, designed as:"DP-Mastersystem[1]"

12.3.4. Connect a station ET 200 M - select the path, created above - insert from hardware-catalog: - Profibus-DP - ET 200 M - IM 153 - connect with DP-address 6 (proposal) It will be opened a new drawing for IM 153 for the configuration of in- and outputmodulecards of this station. - insert into slot 4: - DI/DO - 300 - "SM 323 DI8/DO8 x 24 V/0,5 A The small simulator SM 323 DI8/DO8 x 24 V/0,5 A, orderno.: 6 ES7 323 1BH00 - 0AA0 can be used either for in- or output of one word or for in- and output of one byte each. This can be preselected mechanically by a presetting-switch on the modulecard. In- and outputaddresses can be 2 and 0 as proposed by the programmer.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 12-2


SIMATIC Hands on 12.4 Program to test the connection. FC

46

Profibus-DP

Network 1

Connection of ET 200 M

AN I BEC L MB T QB

5.0

is used to activate the program

1 0

loads the pulsememory of AS 315 and transfers it to the output of ET 200M

A AN L SI A = =

I 2.7 M 0.7 S5T#2s T 0 T 0 M 0.6 Q 8.0

AN L SI A = = BE

M 0.6 S5T#2s T 1 T 1 M 0.7 Q 8.1

input 2.7 of the small simulator, situated in ET 200M, triggers a symmetric pulse of 2 sec which is assigned to autputs 8.0 and 8.1 of AS 315.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 12-3


SIMATIC Hands on

13

AS S7 - 400

13.1 Overview Big brother of AS S7 300 is S7 400. It will not simply replace PLC 135U and 155U of the S5-family.

1. Powersupply 2. Buffer-battery 3. mode-preselection 4. LED for status and fault-indication 5. Memory-card 6- Connector with designation-label

7. CPU 1 8. CPU 2 9. Application-Module FM 456-4 (M7) 10. M7-extension-module 11. Input-/Output-Signalmodules 12. Interfacemodule IM

Automation-System SIMATIC S7-400 in the rack "CR2".

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 13-1


SIMATIC Hands on 13.1.1

Properties

- a great variety of CPU's, of different costs and specifications can be used in the same standardized rack. These are e.g.: CPU

Memory [kByte/MByte]

412 413 413-2 DP 414 414-2 DP 416-1 416-2 DP

48 72 72 128 128 or 384 512 / 0,8 oder 1,6

Digital In/Out. [K] 4 16 16 64 64 128 128

Analog In/Out. [K] 0,25 1 1 4 4 8 8

Performance [ms/k Anweisgn]

SINEC L2-DP

0,2 0,2 0,2 0,1 0,1 0,08 0,08

no no yes no yes no yes

Catalogprice ca. [DM] 1250 1980 2950 3950 4950 6950 13900

Remark: Because of a high innovation-rate with S7-systems, this summary never can show the actual state. The latest news about S7 You'll find in catalogue "ST70" or "Prodok".

Besides this, modules of "M7"- spectrum, e.g.: CPU 488-4 with 80486DX4-100, 33Mhz pulse, RAM until 16MByte, 64 kByte SRAM can be applicated with S7-AS. By this, the AS can be extendet with AT-compatible computer-functions. But, this module is no topic of the present manual. - modules are encapsulated, as everybody was acustomed to when using S5-PLC's 90U until 115U. So far there is protection against static voltage . - easy way of assembling and connecting modules saves time if AS's are configured - various possibilities of bus-operation ( MPI-interface, Profibus, Simatic-Net etc) - connection to operation- and monitoring-systems (COROS, WINCC) possible - adressing of the modules by means of the PG - except a few functions, slots are free addressable, free selectable - configuration is guided by programming-software STEP 7. - operation without fan: no boring noise, no mechanical parts can be used off.

13.1.2

Components:

- Mounting-rack (UR=Universal Rack, CR=Central Rack, ER Extension Rack) - Power Supply PS - Central Processing Unit CPU - Memory Cards (flash-eproms) - Signal Modules SM for digital und analog In-/Outputs - Frontplug - Interfacemodule (IM to connect different racks, e.g.: ET 200M) - Cabelchannel - Sinec-L2 buscabel (Connection of CPU's and PG's)

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 13-2


SIMATIC Hands on - PG-cable to connect PG and CPU - buscomponents to connect to bus-terminals - programmer to configure and test programs - option for fan, required for special modules, with or without filter for dust-protection.

13.2

Configuration

The modules are to be mounted as shown on the picture beneath:

At last they have to be fixed by screws.

13.3

Modules in the training-unit

The power-supply-module PS 407-10A has 2 Lithium-bufferbatteries, which can be used at preselection. The message "battery-fault" is to be reset by key "FMR". Stored for longer (up to 10 Years) lithiumbatteries may produce a passivationlayer. The result is, after insertion of this new (old) battery the fault-indication-LED is not off. Then the battery is to be connected to a short-circuit for about 1 up to max. 3 sec. Hereafter insert the battery into the powersupply again and acknowledge. If even then the indication-LED is not off, the battery is really empty. Battery-monitoring is to be preselected for only one or both batteries or switched off completely by key "BATT.INDIC" on the powersupply. The CPU then indicates batteryfault, but does not go into STOP. If batteries must to be exchanged, to make shure no power-failure deletes ram-data, there is the possibility to connect a fresh battery to the connectors "EXT.-BATT" on the CPU. Do the same procedure to exchange a complete powersupply. Attention! Danger!: Lithium/Thionylchloride-Batteries are explosive if temperatur is higher than 100 째 C. Never try to solder them. They are not rechargable. For use in S7-devices they must be short-circuit-proof. Lithium/Thionylchlorid-Batterien belong to extraordinary waste.

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 13-3


SIMATIC Hands on The Centralunit is connected via connectors on its rear side to powersupply and S7-bus. In our training-unit used CPU S7 413 - 2 DP has additional to it's MPI-Interface (X1), left, another interface for SINEC-L2-DP-Bus (X3),right. You need a torch to read out the inscription! The connection to the PG is the same as mentioned with AS S7-300. Signalmodules of AS 400 are free addressed. Digitalmodules, used in the training-unit are as follows: Digitalinput 32 Channels Input 24 V Powersupply.: [20,4V ≤ 28,8 V] 24 V Signalvoltage: [11 V ≤ 30 V ] with galvanic isolation. Inputcurrent at Signal 1: 6...8 mA Basic-current at Signal 0: ≤ 2,5 mA length of wire with shield: 1000 m without shield.: 600 m Current consumption from bus on the rear side: ≤ 30 mA from L+: ≤ 30 mA Powerloss: 6 W

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 13-4


SIMATIC Hands on Digitaloutput 32 Output-channels dito

Outputvoltage at Signal 1: ≤ ((L+) - 0,3 V) dito Outputcurrent at Signal 1: ≤ 2 A [ 5 mA ≤ 2,4 A ] at Signal 0: ≤ 0,5 mA Lampload ≤ 10 W dito dito

≤ 200 mA out of L+/L1 (without load): ≤ 30 mA 4W

The DI/DQ-modules of the training-unit are ready wired as we are used to with AS 300. Overall-reset just as equal as with S7-300. Never plug in or out any modules during power is on! Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 13-5


SIMATIC Hands on 13.4 Configuration of the training-unit. A new "SIMATIC 400-Station" is to be inserted into our project "TC_ERL". We select from the hardwarecatalogue modules according to the inscription on the training-unit, to adjust it to a "hardware-configuration". For address-check select: Address - Details: Slot 1 2 3 3.1 **) 4 5 6 7 ***) 8 ***) *) **) ***)

Module PS407 10A " CPU413... DP-Master " DI 32.... DO 32... AO 8x14Bit AI 8x13Bit

Orderno. *)

MPI-Add#r. I-Addr.

*)

4 2044

*) *) *) *)

I-Length

Q-Addr.

Q-Length

0 512

4 16

0 0

512

4

16

the order-numbers are inserted automatically by the PG, they are omitted here is only to be parameterized in case of using DP-bus analog-modules, to be configured later

Adjust properties of the CPU: Properties, in window Subnet is to be inserted only:

MPI-Address 4 MPI[4] and the baudrate

The CPU contains a DP-Master-Interface, which is actually not used. Store the configuration and transfer it into the AS hereafter.

13.5 Test Test the configuration by a small program: L T L T

IW0 QW0 IW2 QW2

Each input-bit operates an outputbit.

Change the address of the outputmodule into startaddress "4" now. Then it will fit to the following exercises and examples according to the training-simulator. Back into the window "Hardware-configuration". Doubleclick there the module. In the window " Properties" - "Addresses" - change the address into "4". Make shure having put the AS into "STOP". The testprogram is now:

L IW0 T QW4 L IW2 T QW6 remark: If the message "Object not present" is shown, operate an overall-reset with the CPU and transfer all configuration ones more. Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 13-6


SIMATIC Hands on To copy an existing AS-configuration into the programmer, take softwarekey "Upload"

Upload

Hereafter the desired project is to be selected. Insert into the open window the hardwareaddresses. rack (CPU-) slot Accessible node-address (MPI) remains

=0 =3 =4

To make the configuration from the catalogue, it's possible to use the convenient "drag and drop"- method. The advantage is: Before the left mousekey is released, You can see, if the module fits or not .

Training-Center of the portfolio Industrial Projects and Technical Services (PAS) 13-7


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.