You are on page 1of 152

INTERNAL USE ONLY

TRAINING MATERIAL
FOR SIEMENS S7
2012

Erno Salonen WFI-TS


DocID: DBAC159168
Revision: d
Training material for Siemens S7 2012

Kids, you tried your best and you failed miserably.


The lesson is, never try.

Homer J. Simpson

2 Wrtsil Finland Oy
Training material for Siemens S7 2012

Contents
01. General............................................................................................................ 4
02. Revision history............................................................................................... 4
03. Training equipment.......................................................................................... 5
04. Simatic Manager............................................................................................. 7
05. Starting of Simatic Manager............................................................................. 8
05.1 First view....................................................................................................... 9
05.2 Storage location for projects and multiprojects............................................ 10
05.3 Set PG/PC interface Communication with Simatic S7 PC adapter USB.... 11
05.4 Starting a new S7 project............................................................................ 15
05.5 Inserting S7 program................................................................................... 19
06. Hardware configuration.................................................................................. 17
06.1 Inserting Simatic 300 Station....................................................................... 18
06.2 Starting HW Config...................................................................................... 18
07. Making HW Config for our project.................................................................. 20
08. Set PG/PC interface Communication with ethernet..................................... 32
09. Some CPU settings....................................................................................... 36
10. Symbol table................................................................................................. 38
11. Variable table................................................................................................. 39
12. Exercise 1: FB1 Jogging................................................................................ 44
13. Solution 1: FB1 Jogging................................................................................ 45
14. Exercise 2: FB2 Truncated cone.................................................................... 51
15. Solution 2: FB2 Truncated cone..................................................................... 52
16. Exercise 3: FB3 Using timer functions............................................................ 59
17. Solution 3: FB3 Using timer functions............................................................ 60
18. Exercise 4: Tourist BUS................................................................................. 63
19. Solution 4: Tourist BUS.................................................................................. 65
20. Check Block Consistency.............................................................................. 84
21. Exercise 5: Machine tool................................................................................ 88
22. Solution 5: Machine tool................................................................................ 89
23. Exercise 6: MyPID....................................................................................... 111
24. Solution 6: MyPID........................................................................................ 112
25. Exercise 7: ModbusTCP.............................................................................. 127
26. Solution 7: ModbusTCP............................................................................... 130
27. Reference Data............................................................................................ 143
28. Archive........................................................................................................ 148

Wrtsil Finland Oy 3
Training material for Siemens S7 2012

01. General

zzThis document is made for training purposes only. This document is property of Wrtsil and the
distribution of this document outside Wrtsil is strictly prohibited.

zzInstructions and settings in this document are only valid when using Simatic S7 training equipment
in Turku, Finland.

zzThis document gives you an introduction how to use Simatic Manager with practical examples.

02. Revision history


Revision Date Author Reference Description

a 8.9.2011 esa First draft

b 27.12.2011 esa Until exercise 5

c 6.1.2012 esa First release

d 1.6.2012 esa ModbusTCP exercise added

4 Wrtsil Finland Oy
Training material for Siemens S7 2012

03. Training equipment

Wrtsil Finland Oy 5
Training material for Siemens S7 2012

6 Wrtsil Finland Oy
Training material for Siemens S7 2012

04. Simatic Manager

Overview of Simatic Manager

Wrtsil Finland Oy 7
Training material for Siemens S7 2012

05. Starting of Simatic Manager


Simatic Manager can be started in two ways:

1. double-click Simatic Manager icon on the desktop

2. or start Simatic Manager from Start menu

8 Wrtsil Finland Oy
Training material for Siemens S7 2012

05.1 First view


View when opening Simatic Manager

Wrtsil Finland Oy 9
Training material for Siemens S7 2012

05.2 Storage location for projects and multiprojects


Options Customize

10 Wrtsil Finland Oy
Training material for Siemens S7 2012

05.3 Set PG/PC interface Communication with Simatic S7 PC adapter USB


Simatic S7 PC adapter USB (Material number PAAE093507)

Wrtsil Finland Oy 11
Training material for Siemens S7 2012

Connect your Simatic S7 PC adapter USB to MPI/DP port in the CPU.

zzOptions Set PG/PC Interface

12 Wrtsil Finland Oy
Training material for Siemens S7 2012

zzSelect PC Adapter(MPI)

zzPress OK

Wrtsil Finland Oy 13
Training material for Siemens S7 2012

zzPress Accessible nodes

zzOpen Blocks

zzDelete all the other blocks than System function blocks (SFB, SFC) from CPU Online memory

Now you are ready to start your exercise!


14 Wrtsil Finland Oy
Training material for Siemens S7 2012

05.4 Starting a new S7 project


zzFile New

zzWrite your project name to Name:

zzPress OK

Wrtsil Finland Oy 15
Training material for Siemens S7 2012

05.5 Inserting S7 program

Simatic Manager automatically names the new S7 Program as S7 Program(1). We can rename it
to S7 Program.

zzPress F2 or mouse right-click and Rename

16 Wrtsil Finland Oy
Training material for Siemens S7 2012

06. Hardware configuration

Hardware used in our exercise

Wrtsil Finland Oy 17
Training material for Siemens S7 2012

06.1 Inserting Simatic 300 Station

Simatic Manager automatically names the new station as Simatic300(1). We can rename it to
Simatic300.

zzPress F2 or mouse right-click and Rename

06.2 Starting HW Config

zzDouble-click Simatic 300

zzDouble-click Hardware symbol

HW Config is now opened


18 Wrtsil Finland Oy
Training material for Siemens S7 2012

zzTo open/close Hardware Catalog press

Wrtsil Finland Oy 19
Training material for Siemens S7 2012

07. Making HW Config for our project


1. Double-click Rail from Catalog

20 Wrtsil Finland Oy
Training material for Siemens S7 2012

2. Put the CPU 315-2PN/DP into slot 2

Open 6ES7315-2EH14-0AB0 and double-click V3.1

3. In the Properties window define CPUs IP address: 192.168.0.1 (This is a default)


and Subnet mask: 255.255.255.0. Press OK.

Wrtsil Finland Oy 21
Training material for Siemens S7 2012

4. Drag Digital input module DI32 24V into slot 4 (6ES7321-1BL00-0AA0).

22 Wrtsil Finland Oy
Training material for Siemens S7 2012

5. Do the same for the remaining modules. Result should look like this:

Wrtsil Finland Oy 23
Training material for Siemens S7 2012

6. Double-click FM350 COUNTER (Note! Driver for FM350 needs to be installed)

7. Double-click Encoders and put the settings as follows. Press OK.

24 Wrtsil Finland Oy
Training material for Siemens S7 2012

8. Double-click Inputs and put the settings as follows. Press OK.

9. Double-click Operating Modes and put the settings as follows. Press OK.

Wrtsil Finland Oy 25
Training material for Siemens S7 2012

10. Double-click Outputs and put the settings for DO1/DO2 as follows. Press OK.

26 Wrtsil Finland Oy
Training material for Siemens S7 2012

11. Press Save and close window.

Wrtsil Finland Oy 27
Training material for Siemens S7 2012

zz12. Press Save and Compile

28 Wrtsil Finland Oy
Training material for Siemens S7 2012

7. Download HW Config to CPU

8. Press OK.

Wrtsil Finland Oy 29
Training material for Siemens S7 2012

9. Press OK.

10. Press OK.

30 Wrtsil Finland Oy
Training material for Siemens S7 2012

11. Press Yes.

Wrtsil Finland Oy 31
Training material for Siemens S7 2012

08. Set PG/PC interface Communication with ethernet


If you want to change the communication from USB Adapter to Ethernet, do as follows:

1. Open Network Connections Select your Local Area Connection


Internet Protocol (TCP/IP) Properties

32 Wrtsil Finland Oy
Training material for Siemens S7 2012

2. Define your laptop IP address as follows

3. Press OK

Wrtsil Finland Oy 33
Training material for Siemens S7 2012

4. Connect you Ethernet cable to Ethernet switch Scalance X206-1

5. Options Set PG/PC Interface

34 Wrtsil Finland Oy
Training material for Siemens S7 2012

6. Select correct interface from Interface Parameter Assignment Used and press OK
(Note! First disconnect your USB adapter from CPU)

Wrtsil Finland Oy 35
Training material for Siemens S7 2012

09. Some CPU settings


zzStart HW Config

zzDouble-click CPU 315-2PN/DP and open sheet Cycle/Clock Memory

zzPut Scan cycle monitoring time [ms]: 150

zzEnable Clock memory and put Memory Byte: 10

If PLC cycle time exceeds 150ms, CPU will go to STOP mode. If OB80 Cycle time fault is

programmed, the scan cycle time is multiplied by 2. If PLC cycle time is still exceeded after that,
CPU will go to STOP mode.

36 Wrtsil Finland Oy
Training material for Siemens S7 2012

Clock Memory:

M10.7 M10.6 M10.5 M10.4 M10.3 M10.2 M10.1 M10.0

Frequency [HZ] 0.5 0.62 1 1.25 2 2.5 5 10

Duration [s] 2 1.6 1 0.8 0.5 0.4 0.2 0.1

zzPress OK

zzSave and Compile

zzDownload to module

Wrtsil Finland Oy 37
Training material for Siemens S7 2012

10. Symbol table


zzDouble-click Symbols

zzWrite I0.0 to Address

zzWrite Start to Symbol

zzWrite Engine start to Comment

zzPress Enter

zzWrite these inputs/outputs to Symbols. (Note! Remember to update your Symbol table, when
adding additional symbols to your project).

zzPress Save

38 Wrtsil Finland Oy
Training material for Siemens S7 2012

11. Variable table


Next we will test the inputs and outputs of Training equipment.

zzInsert new Variable Table

Wrtsil Finland Oy 39
Training material for Siemens S7 2012

zzGive Symbolic Name and Symbol Comment to your Variable table and press OK

zzOpen Variable table

zzWrite the following inputs and outputs to your Variable table and press Save (if you want to use the
Variable table later on)

40 Wrtsil Finland Oy
Training material for Siemens S7 2012

zzPress to start monitoring variables

zzFirst test your inputs one by one

Wrtsil Finland Oy 41
Training material for Siemens S7 2012

Output testing is done the following way:

zzWrite 1 to Modify value of the output you want to force active and press Enter

zzRight click mouse Activate modify value

42 Wrtsil Finland Oy
Training material for Siemens S7 2012

zzPress to start monitoring modified values

zzTo disable forced values, first disable monitor variables , then write 0 to Modify value of the
output you want to disable forcing and press Enter

zzRight-click mouse Activate modify value

After this you can check that there are now more forced values active by pressing Alt+F2

Wrtsil Finland Oy 43
Training material for Siemens S7 2012

12. Exercise 1: FB1 Jogging


Now we can do our first program. Do the jogging function for rail.

zzRail should start when pressing start button

zzRail direction can be changed from engine control remote/local switch


(remote=LEFT, local=Right)

zzRail speed should be slow

44 Wrtsil Finland Oy
Training material for Siemens S7 2012

13. Solution 1: FB1 Jogging


1. Insert new object

Wrtsil Finland Oy 45
Training material for Siemens S7 2012

2. Name it to FB1 and press OK

3. Open your newly created FB1 by double-clicking it

4. Write the following to Block Comment and to Network 1 Comment

46 Wrtsil Finland Oy
Training material for Siemens S7 2012

5. Then do the following networks:

Network 1

Network 2

Wrtsil Finland Oy 47
Training material for Siemens S7 2012

Network 3

6. Press Save

7. Press Download

Remember to check PQW352 settings in HW Config


48 Wrtsil Finland Oy
Training material for Siemens S7 2012

8. Open your OB1 and add FB1 to Network 1

9. Write DB50 to ??? and press Enter (We will use DB1 at a later stage)

10. Press Yes

11. Press Save and close OB1

Wrtsil Finland Oy 49
Training material for Siemens S7 2012

12. Select now OB1, FB1 and DB50 and download them to PLC

13. Test your project

50 Wrtsil Finland Oy
Training material for Siemens S7 2012

14. Exercise 2: FB2 Truncated cone


Next we will calculate the volume of truncated cone.

zzVolume V can be calculated from the following formula:

zzWhere h = 5
R=3
r=1

Wrtsil Finland Oy 51
Training material for Siemens S7 2012

15. Solution 2: FB2 Truncated cone


1. This exercise is done with STL

First define the following Variables

52 Wrtsil Finland Oy
Training material for Siemens S7 2012

Networks 1 and 2

Wrtsil Finland Oy 53
Training material for Siemens S7 2012

Network 3

2. Press Save

3. Press Download

4. Test your project

54 Wrtsil Finland Oy
Training material for Siemens S7 2012

Wrtsil Finland Oy 55
Training material for Siemens S7 2012

? What if we want to test it with other values?


5. Insert new Data block

6. Open your newly created DB200 and add FinalResultToDB

7. Press Save and close DB200

56 Wrtsil Finland Oy
Training material for Siemens S7 2012

8. Open your OB1 and add FB2 to Network 2

9. Write DB2 to ??? and press Enter

10. Press Yes

Wrtsil Finland Oy 57
Training material for Siemens S7 2012

11. Write new values to h, R_big and R_small. Write DB200.DBD0 to Final_result

12. Press Save and close OB1

13. Select now OB1, FB2, DB2 and DB200 and download them to PLC

14. Test your project

58 Wrtsil Finland Oy
Training material for Siemens S7 2012

16. Exercise 3: FB3 Using timer functions


Next well look into timers. We will test the following timers:

zzPulse timer TP

zzOn-delay timer TON

When pressing Stop button,


Stop pressed should activate in

HMI.

If Stop button is pressed for 10


seconds, the yellow indication
should activate for 8 seconds
and text Stop pulse on should
blink with 10 Hz frequency during
this period.

Wrtsil Finland Oy 59
Training material for Siemens S7 2012

17. Solution 3: FB3 Using timer functions


1. First do the STAT variables:

zzWrite TON1 and write data type sfb4. press Enter

zzWrite TP1 and write data type sfb3. press Enter

60 Wrtsil Finland Oy
Training material for Siemens S7 2012

2. Then Open Multible instances and place TON1 to network 1 and TP1 to network 2

Wrtsil Finland Oy 61
Training material for Siemens S7 2012

3. Networks 1, 2 and 3

Note! Remember to write these


also to Symbol Table

M30.0
M30.1
M30.2

62 Wrtsil Finland Oy
Training material for Siemens S7 2012

18. Exercise 4: Tourist BUS

A sightseeing bus travels around 3 stops. The bus does 5 trips daily, so that

zzFirst 2 rounds it stops at every location and stays there for 5 seconds

zzThe remaining 3 rounds it only stops at Stop2, if Stop button is pressed before bus reaches Stop2

zzSightseeing trips begins and ends at Stop 1. Trip is started with Start button.

zzBus speed is tuned from PIW288.

zzBus speed is limited to 40% of the maximum speed.

Stop 3
Stop 2

Stop 1

Wrtsil Finland Oy 63
Training material for Siemens S7 2012

M500.0 M500.1 M500.2

64 Wrtsil Finland Oy
Training material for Siemens S7 2012

19. Solution 4: Tourist BUS


zzWe will do this excercise with three functions blocks:

FB5 Main control for rail (FBD)

FB4 Sightseeing (Graph)

FB19 Analog I/O (FBD)

zzWe will also use the following Wrtsil Standard blocks in this exercise:

FB110 M_SCIRHHLL

FC79 AO_SCALE

Wrtsil Finland Oy 65
Training material for Siemens S7 2012

FB5 Main control for rail

1. Lets start with FB5 Main control for rail

66 Wrtsil Finland Oy
Training material for Siemens S7 2012

Networks 1-3

Wrtsil Finland Oy 67
Training material for Siemens S7 2012

Networks 4-6

68 Wrtsil Finland Oy
Training material for Siemens S7 2012

Networks 7-8

Wrtsil Finland Oy 69
Training material for Siemens S7 2012

Networks 9-10

70 Wrtsil Finland Oy
Training material for Siemens S7 2012

FB19 Analog I/O

2. Next we will do FB19 Analog I/O. Copy Wrtsil standard blocks FB110 M_SCIRHHLL and
FC79 AO_SCALE into your project.

3. Use FB110 as a Multiple instance in network 1

Wrtsil Finland Oy 71
Training material for Siemens S7 2012

4. Call FC79 in network 2

Remember to check PIW288 Settings in HW Config


72 Wrtsil Finland Oy
Training material for Siemens S7 2012

FB4 Sightseeing

5. FB4 Sightseeing is done with GRAPH

Wrtsil Finland Oy 73
Training material for Siemens S7 2012

6. Insert new Function Block FB4 Sightseeing (GRAPH) and press OK.

74 Wrtsil Finland Oy
Training material for Siemens S7 2012

7. Insert Drag-and-Drop

8. Select Step + Transition and place it after S1

Wrtsil Finland Oy 75
Training material for Siemens S7 2012

9. Like this!

10. Select Insert AND Box

76 Wrtsil Finland Oy
Training material for Siemens S7 2012

11. Place it to Transition T1

12. Write I0.0 to ??.?

Wrtsil Finland Oy 77
Training material for Siemens S7 2012

13. Insert Action

14. And place it to Step1

78 Wrtsil Finland Oy
Training material for Siemens S7 2012

15. Write R to ?

16. Write M59.2 to ???

Wrtsil Finland Oy 79
Training material for Siemens S7 2012

17. Result should like this:

M59.2
I0.0 M59.1

M51.0

M59.3

I0.6

NEG!
M59.3

I0.6

M56.0
M51.1

M52.0
I0.7
M56.0

M52.1
NEG!
M59.6
M59.5

80 Wrtsil Finland Oy
Training material for Siemens S7 2012

I1.0 M53.0

M53.1

M54.0
I0.7

M54.1

M59.6 NEG!

M59.5

M59.0

M59.2

NEG!

M59.0

Wrtsil Finland Oy 81
Training material for Siemens S7 2012

18. Finally, add FB4, FB5 and FB19 to OB1.


Add also HMI control memory bits M500.0 and M500.1 to OB1.

82 Wrtsil Finland Oy
Training material for Siemens S7 2012

Wrtsil Finland Oy 83
Training material for Siemens S7 2012

20. Check Block Consistency


Now it is a good time to compile our project.

1. Check Block Consistency

84 Wrtsil Finland Oy
Training material for Siemens S7 2012

2. Compile all

Wrtsil Finland Oy 85
Training material for Siemens S7 2012

3. Result should look like this:

86 Wrtsil Finland Oy
Training material for Siemens S7 2012

4. Download your project to PLC.

5. Test your project.

Wrtsil Finland Oy 87
Training material for Siemens S7 2012

21. Exercise 5: Machine tool


In the next exercise well do a machine tool,
where position of the rail is given in millimeters
and the deceleration curve can be decided by the
user.

zzAcceleration function is done automatically by


the frequency converter.

zzIn this exercise we will be using for the first


time also SCL (Structured Control Language)
programming.

zzThe deceleration ramp is done with Wrtsil


Standard block Curvexy.

User input here!

88 Wrtsil Finland Oy
Training material for Siemens S7 2012

22. Solution 5: Machine tool


DB200 Project constants

Note! If you want to change Initial values afterwards, remember to Initialize Data Block.

View Data View
Edit Initialize Data Block

Wrtsil Finland Oy 89
Training material for Siemens S7 2012

File Open Sample projects zEn23_01_FMx50-1

(Note! In order to use this Sample project, you first need to install the FM350-1 driver from CD)

Copy all other blocks than OB1 from the sample project to your own project

90 Wrtsil Finland Oy
Training material for Siemens S7 2012

FB13 Positioner

1. Insert new SCL Source

2. Rename it to Positioner and open it

Wrtsil Finland Oy 91
Training material for Siemens S7 2012

3. Insert Block Template FB

4. Empty block template inserted

5. Write your SCL code as follows:

92 Wrtsil Finland Oy
Training material for Siemens S7 2012

Wrtsil Finland Oy 93
Training material for Siemens S7 2012

6. Press Save

7. File Compile

8. If everything ok (i.e. no errors), it should look like this:

9. CTRL+F4 closes the SCL editor

94 Wrtsil Finland Oy
Training material for Siemens S7 2012

FB6 Machine tool

10. Variables for FB6

Wrtsil Finland Oy 95
Training material for Siemens S7 2012

11. Networks 1-2

96 Wrtsil Finland Oy
Training material for Siemens S7 2012

12. Network 3

Wrtsil Finland Oy 97
Training material for Siemens S7 2012

FB7 Ramp

13. Variables for FB7

98 Wrtsil Finland Oy
Training material for Siemens S7 2012

14. Copy Wrtsil standard block FB128 CURVEXY into your project. We will use it for the
deceleration.

15. Open Deceleration.xlsx.

Values in green are confugurable for user. X-values are position difference from the desired position.
With CURVEXY you can decide how slow or fast is the deceleration of the rail.

Wrtsil Finland Oy 99
Training material for Siemens S7 2012

16. Network 1

16. Network 1

100 Wrtsil Finland Oy


Training material for Siemens S7 2012

17. Networks 2-3

Wrtsil Finland Oy 101


Training material for Siemens S7 2012

18. Network 4

102 Wrtsil Finland Oy


Training material for Siemens S7 2012

19. Network 5

Wrtsil Finland Oy 103


Training material for Siemens S7 2012

20. Networks 6-7

104 Wrtsil Finland Oy


Training material for Siemens S7 2012

OB1

21. Finally open your OB1 and update it to as follows:

Networks 1-2

Wrtsil Finland Oy 105


Training material for Siemens S7 2012

Networks 3-4

106 Wrtsil Finland Oy


Training material for Siemens S7 2012

Network 5-6

Wrtsil Finland Oy 107


Training material for Siemens S7 2012

Network 7 can be copied from Sample project zEn23_01_FMx50-s OB1


108 Wrtsil Finland Oy


Training material for Siemens S7 2012

Network 7

Wrtsil Finland Oy 109


Training material for Siemens S7 2012

Networks 8-9

110 Wrtsil Finland Oy


Training material for Siemens S7 2012

23. Exercise 6: MyPID


In the next exercise well control the Diesel oil level in the Day-tank.

zzTank specification:

Inlet valve opening 0 mm - 50 mm (0 m - 0.05 m)

Outlet valve opening 0 mm 22.5 mm (0 m - 0.0225 m)

Pressure at inlet pipe 1.0 bar

Density of Diesel oil 900 kg/m3

Drums diameter 0.5 m

Drums height 1.0 m

zzEngine load is tuned with PIW288

zzGain (P), Reset time (I) and Tank level SP [0-100%] are user inputs.

Wrtsil Finland Oy 111


Training material for Siemens S7 2012

24. Solution 6: MyPID


DB200 Project constants

112 Wrtsil Finland Oy


Training material for Siemens S7 2012

FB14 Astia

1. Sources Insert New Object SCL Source

2. Rename it to Astia

Wrtsil Finland Oy 113


Training material for Siemens S7 2012

3. Open your Astia Source File

4. After this, open Astia.txt

114 Wrtsil Finland Oy


Training material for Siemens S7 2012

5. Edit Select All

Copy

Wrtsil Finland Oy 115


Training material for Siemens S7 2012

6. Paste the contents of Astia.txt to Astia.scl

116 Wrtsil Finland Oy


Training material for Siemens S7 2012

7. Press Save

8. File Compile

9. If everything ok (i.e. no errors), it should look like this:

10. CTRL+F4 closes the SCL editor

Wrtsil Finland Oy 117


Training material for Siemens S7 2012

FB8 MyPID

11. Variables for FB8

118 Wrtsil Finland Oy


Training material for Siemens S7 2012

12. Network 1

Wrtsil Finland Oy 119


Training material for Siemens S7 2012

13. Networks 2-3

120 Wrtsil Finland Oy


Training material for Siemens S7 2012

14. Network 4

Wrtsil Finland Oy 121


Training material for Siemens S7 2012

15. Network 5

( Libraries Standard Library PID Control Blocks)

122 Wrtsil Finland Oy


Training material for Siemens S7 2012

Wrtsil Finland Oy 123


Training material for Siemens S7 2012

16. Networks 6-7

124 Wrtsil Finland Oy


Training material for Siemens S7 2012

17. Networks 8-9

Wrtsil Finland Oy 125


Training material for Siemens S7 2012

18. Network 10

OB1

19. Network 10

126 Wrtsil Finland Oy


Training material for Siemens S7 2012

25. Exercise 7: ModbusTCP


25. Exercise 7: ModbusTCP
Hello! Hello.

Whats your Im VAMP 210.


name? Whats yours?

Im CPU
OK,
315-PN/DP.
whatever

Can us two lonely souls You have to do


someday become one? me first

Configure a standardised
??? MODBUS/TCP
communication prototol
for me.

Wrtsil Finland Oy 127


Training material for Siemens S7 2012

InInthe
thefifinal exercise well
nal exercise wellconfigure
configurea a
ModbusTCP connection
ModbusTCP for VAMP
connection 210 Generator
for VAMP Protection
210 Generator Protection
Relay.
Relay.
Protocols are
Protocols are used
usedwhen
whenexchanging
exchangingdata between
data heterogeneous
between heterogeneouscommunication partners.
communication In this In this
partners.
exercise we
exercise we are
are using
usingModbusTCP
ModbusTCP protocol. TheThe
protocol. controller, generator
controller, protection
generator relay and
protection operator
relay and operator
panel are located in the same IP subnet. Therefore a gateway is not needed.
panel are located in the same IP subnet. Therefore a gateway is not needed.

Schematic layout in our project


Schematic layout in our project

Modbus

Ethernet

CPU 315-2PN/DP VAMP 210


IP Address: IP Address:
192.168.0.1 192.168.0.17

S7 Connection Beijer E1101 HMI


IP Address:
192.168.0.120

128 Wrtsil Finland Oy


Training material for Siemens S7 2012

From VAMP 210 protocol mappings we can see that Alive indicator is written in to Modbus address
402001.

From VAMP 210 protocol mappings we can see that Alive indicator is written in to Modbus
address 402001.

Nowwe
Now wewant
wantananillustration
illustration
of of
thethe Alive
Alive indicator
indicator value
value fromfrom
VAMPVAMP 210our
210 into into ourscreen.
HMI HMI screen.

DB121.DBW32

Wrtsil Finland Oy 129


Training material for Siemens S7 2012

26. Solution 7: ModbusTCP


OB100 COMPLETE RESTART

1. First create an OB100 into your project

2. Then open project mbtcp_te and copy all the other blocks than OB1 and the SFB(s) and SFC(s) into
your project

130 Wrtsil Finland Oy


Training material for Siemens S7 2012

3. Open FB17 Communication and modify it as follows

Network 1

Wrtsil Finland Oy 131


Training material for Siemens S7 2012

Network 2

DB used for holding registers

(0x163)+(0x162)+(7x161)+(9x160)

= 0 + 0 + 112 + 9 = 121

DB121

Modbus start address of DB defined on


DB_HOLD

(0x163)+(7x162)+(12x161)+(1x160)

= 0 + 1792 + 192 + 1 = 1985

Thus,

(1991 1985) * 2 = 12

DB address:

DB121.DBW32

132 Wrtsil Finland Oy


Training material for Siemens S7 2012

Networks 3 & 4

Wrtsil Finland Oy 133


Training material for Siemens S7 2012

4.4. Open DB22


Open DDR_DB
DB22 DDR_DBand andlocate
locate row where value
row where valuefor
forstring
stringvariable
variable
IP3IP3 is set.
is set. ThenThen do the following
do the
modifications
following modifications

Register type. TRUE = Input register,


FALSE = Holding register.

Input register (3xxxx)


Holding register (4xxxx)


Note!
Note! When changingInitial
When changing Initialvalues,
values, remember
remember to Initialize
to Initialize Data
Data Block.
Block.
View
View Data View
Data View
Edit
Edit InitializeData
Initialize DataBlock
Block

134 Wrtsil Finland Oy


Training material for Siemens S7 2012

5. OB1

Network 11

Wrtsil Finland Oy 135


Training material for Siemens S7 2012

Note! If you want to change the Address of Alive indicator from DB121.DBW20 to DB121.DBW32
Note! If you want to change the Address of Alive indicator from DB121.DBW20 to DB121.DBW32
you have to use DB_HOLD_ADD in FB170 MBTCP_READ_WRITE. This is how it works
you have to use DB_HOLD_ADD in FB170 MBTCP_READ_WRITE. This is how it works

Lets first use same values in START_ADDRESS and DB_HOLD_ADD (16#07C7 1991).
Lets first use same values in START_ADDRESS and DB_HOLD_ADD (16#07C7 1991).

136 Wrtsil Finland Oy


Training material for Siemens S7 2012

When now opening DB121 we see that the Alive indicator is written to DB121.DBW20.
When now opening DB121 we see that the Alive indicator is written to DB121.DBW20.

Now whenwe
Now when wewant
wanttotochange
change thethe address
address of Alive
of Alive indicator
indicator from DB121.DBW20
from DB121.DBW20 to DB121.DBW32, we
to DB121.DBW32,
have to change
we have the
to change thevalue
valueofofDB_HOLD_ADD
DB_HOLD_ADD toto16#07C1
16#07C1 (1985).
(1985).

Wrtsil Finland Oy 137


Training material for Siemens S7 2012

When opening DB121


When we DB121
opening see that thethat
we see Alive
theindicator is then
Alive indicator written
is then totoDB121.DBW32.
written DB121.DBW32.

Remember,that
Remember, thatwewearent
arent now
now actually
actually reading
reading addresses
addresses 401987
401987 401990,
401990, because because we have set
we have set
START_ADDR
START_ADDR to to 1991
1991 in DB22.
in DB22.

138 Wrtsil Finland Oy


Training material for Siemens S7 2012

6. Then you can run Check block consistency

7. And if everything looks ok, download blocks to PLC

8. Restart your CPU in order to activate Initialization bit in OB100.

Wrtsil Finland Oy 139


Training material for Siemens S7 2012

9. Now you can monitor FB17 and DB121 in Online. It should look like this:

140 Wrtsil Finland Oy


Training material for Siemens S7 2012

Wrtsil Finland Oy 141


Training material for Siemens S7 2012

Modbus Alive indicator


from VAMP 210

142 Wrtsil Finland Oy


Training material for Siemens S7 2012

27. Reference Data

Q: What blocks are activating Q4.6 (Rail direction)?

Q: Where is DB200.DBD10 (Current position) written? Which blocks are reading it?

Wrtsil Finland Oy 143


Training material for Siemens S7 2012

1. Blocks Reference Data Display

2. Press Yes

144 Wrtsil Finland Oy


Training material for Siemens S7 2012

3. OK

4. Press Filter

Wrtsil Finland Oy 145


Training material for Siemens S7 2012

5. Activate DBs. Press OK.

146 Wrtsil Finland Oy


Training material for Siemens S7 2012

Q: What blocks are activating Q4.6 (Rail direction)?

A: FB1 (Jogging) NW2

FB5 (Main control for Rail) NW4

FB7 (Ramp) NW7

Q: Where is DB200.DBD10 (Current position) written? Which blocks are reading it?

A: It is written in

FB6 (Machine Tool) NW3

It is read in

FB7 (Ramp) NW4 and NW5

Wrtsil Finland Oy 147


Training material for Siemens S7 2012

28. Archive
Now you are ready to finish your exercise.

1. File Archive

2. Select the project you want to archive and press OK

3. Give File name to your project and press Save

148 Wrtsil Finland Oy


Training material for Siemens S7 2012

4. Press OK

5. Create a new folder and name it.

Wrtsil Finland Oy 149


Training material for Siemens S7 2012

6. Archive your project

? Wrtsil PLC backups are named as follows:

PLC_YYMMDD_PROJECTN.ZIP

7. Name your .zip file and press ADD

150 Wrtsil Finland Oy


Training material for Siemens S7 2012

8. Press OK

9. Done!

Wrtsil Finland Oy 151


Wrtsil is a global leader in complete lifecycle power solutions for the
marine and energy markets. By emphasising technological innovation
and total efficiency, Wrtsil maximises the environmental and economic
performance of the vessels and power plants of its customers. Wrtsil is
listed on the NASDAQ OMX Helsinki, Finland.

WRTSIL is a registered trademark. Copyright 2012 Wrtsil Corporation.

You might also like