Training Material for Siemens S7 2012
Short Description
Training Material for Siemens S7 2012...
Description
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
Wärtsilä 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
Wärtsilä Finland Oy
3
Training material for Siemens S7
2012
01. General
zzThis document is made for training purposes only. This document is property of Wärtsilä and the distribution of this document outside Wärtsilä 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
4
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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
03. Training equipment
Wärtsilä Finland Oy
5
Training material for Siemens S7
6
2012
Wärtsilä Finland Oy
Training material for Siemens S7
2012
04. Simatic Manager
Overview of Simatic Manager
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
05.1 First view View when opening Simatic Manager
Wärtsilä Finland Oy
9
Training material for Siemens S7
2012
05.2 Storage location for projects and multiprojects Options à Customize…
10
Wärtsilä 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)
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
zzSelect PC Adapter(MPI) zzPress OK
Wärtsilä 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
Wärtsilä 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
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
06. Hardware configuration
Hardware used in our exercise
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
zzTo open/close Hardware Catalog press
Wärtsilä Finland Oy
19
Training material for Siemens S7
2012
07. Making HW Config for our project 1. Double-click Rail from Catalog
20
Wärtsilä Finland Oy
Training material for Siemens S7
2012
2. Put the CPU 315-2PN/DP into slot 2 Open 6ES7 315-2EH14-0AB0 and double-click V3.1
3. In the Properties window define CPU’s IP address: 192.168.0.1 (This is a default) and Subnet mask: 255.255.255.0. Press OK.
Wärtsilä Finland Oy
21
Training material for Siemens S7
2012
4. Drag Digital input module DI32 24V into slot 4 (6ES7 321-1BL00-0AA0).
22
Wärtsilä Finland Oy
Training material for Siemens S7
2012
5. Do the same for the remaining modules. Result should look like this:
Wärtsilä 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
Wärtsilä 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.
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
11. Press Save and close window.
Wärtsilä Finland Oy
27
Training material for Siemens S7
2012
zz12. Press Save and Compile
28
Wärtsilä Finland Oy
Training material for Siemens S7
2012
7. Download HW Config to CPU
8. Press OK.
Wärtsilä Finland Oy
29
Training material for Siemens S7
2012
9. Press OK.
10. Press OK.
30
Wärtsilä Finland Oy
Training material for Siemens S7
2012
11. Press Yes.
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
2. Define your laptop IP address as follows
3. Press OK
Wärtsilä 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
Wärtsilä 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)
Wärtsilä 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
Wärtsilä 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
Wärtsilä 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
Wärtsilä 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
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
zzPress
2012
to start monitoring variables
zzFirst test your inputs one by one
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7 zzPress
2012
to start monitoring modified values
zzTo disable forced values, first disable monitor variables output you want to disable forcing and press Enter
, then write “0” to Modify value of the
zzRight-click mouse à Activate modify value
ÎÎ After this you can check that there are now more forced values active by pressing Alt+F2
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
13. Solution 1: FB1 Jogging 1. Insert new object
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
5. Then do the following networks: à Network 1
à Network 2
Wärtsilä 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
Wärtsilä 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
Wärtsilä Finland Oy
and close OB1
49
Training material for Siemens S7
2012
12. Select now OB1, FB1 and DB50 and download them to PLC
13. Test your project
50
Wärtsilä 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
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
à Networks 1 and 2
Wärtsilä Finland Oy
53
Training material for Siemens S7
2012
à Network 3
2. Press Save 3. Press Download 4. Test your project
54
Wärtsilä Finland Oy
Training material for Siemens S7
Wärtsilä Finland Oy
2012
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
56
and close DB200
Wärtsilä 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
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
16. Exercise 3: FB3 Using timer functions Next we’ll 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.
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
2. Then Open Multible instances and place TON1 to network 1 and TP1 to network 2
Wärtsilä 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
Wärtsilä 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
Wärtsilä Finland Oy
63
Training material for Siemens S7
M500.0
64
2012
M500.1
M500.2
Wärtsilä 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 Wärtsilä Standard blocks in this exercise: ––FB110 M_SCIRHHLL ––FC79 AO_SCALE
Wärtsilä Finland Oy
65
Training material for Siemens S7
2012
FB5 Main control for rail 1. Lets start with FB5 Main control for rail
66
Wärtsilä Finland Oy
Training material for Siemens S7
2012
à Networks 1-3
Wärtsilä Finland Oy
67
Training material for Siemens S7
2012
à Networks 4-6
68
Wärtsilä Finland Oy
Training material for Siemens S7
2012
à Networks 7-8
Wärtsilä Finland Oy
69
Training material for Siemens S7
2012
à Networks 9-10
70
Wärtsilä Finland Oy
Training material for Siemens S7
2012
FB19 Analog I/O 2. Next we will do FB19 Analog I/O. Copy Wärtsilä standard blocks FB110 M_SCIRHHLL and FC79 AO_SCALE into your project. 3. Use FB110 as a Multiple instance in network 1
Wärtsilä Finland Oy
71
Training material for Siemens S7
2012
4. Call FC79 in network 2
ÎÎ Remember to check PIW288 Settings in HW Config
72
Wärtsilä Finland Oy
Training material for Siemens S7
2012
FB4 Sightseeing 5. FB4 Sightseeing is done with GRAPH
Wärtsilä Finland Oy
73
Training material for Siemens S7
2012
6. Insert new Function Block FB4 Sightseeing (GRAPH) and press OK.
74
Wärtsilä Finland Oy
Training material for Siemens S7
2012
7. à Insert à Drag-and-Drop
8. Select Step + Transition and place it after S1
Wärtsilä Finland Oy
75
Training material for Siemens S7
2012
9. Like this!
10. Select Insert AND Box
76
Wärtsilä Finland Oy
Training material for Siemens S7
2012
11. Place it to Transition T1
12. Write I0.0 to ??.?
Wärtsilä Finland Oy
77
Training material for Siemens S7
2012
13. à Insert à Action
14. And place it to Step1
78
Wärtsilä Finland Oy
Training material for Siemens S7
2012
15. Write R to ?
16. Write M59.2 to ???
Wärtsilä Finland Oy
79
Training material for Siemens S7
2012
17. Result should like this:
M59.2 M59.1
I0.0
M51.0 M59.3 I0.6 NEG! M59.3 I0.6
M56.0 M51.1
M52.0 M56.0
I0.7
M52.1 NEG! M59.6 M59.5
80
Wärtsilä Finland Oy
Training material for Siemens S7
I1.0
2012
M53.0
M53.1
M54.0
I0.7
M54.1 M59.6
NEG!
M59.5
M59.0
M59.2 NEG! M59.0
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
Wärtsilä Finland Oy
2012
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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
2. à Compile all
Wärtsilä Finland Oy
85
Training material for Siemens S7
2012
3. Result should look like this:
86
Wärtsilä Finland Oy
Training material for Siemens S7
2012
4. Download your project to PLC.
5. Test your project.
Wärtsilä Finland Oy
87
Training material for Siemens S7
2012
21. Exercise 5: Machine tool In the next exercise we’ll 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 Wärtsilä Standard block Curvexy.
User input here!
88
Wärtsilä 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
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
FB13 Positioner 1. Insert new SCL Source
2. Rename it to Positioner and open it
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
Wärtsilä Finland Oy
2012
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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
FB6 Machine tool 10. Variables for FB6
Wärtsilä Finland Oy
95
Training material for Siemens S7
2012
11. à Networks 1-2
96
Wärtsilä Finland Oy
Training material for Siemens S7
2012
12. à Network 3
Wärtsilä Finland Oy
97
Training material for Siemens S7
2012
FB7 Ramp 13. Variables for FB7
98
Wärtsilä Finland Oy
Training material for Siemens S7
2012
14. Copy Wärtsilä 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.
Wärtsilä Finland Oy
99
Training material for Siemens S7
2012
16. à Network 1 16. à Network 1
100
Wärtsilä Finland Oy
Training material for Siemens S7
2012
17. à Networks 2-3
Wärtsilä Finland Oy
101
Training material for Siemens S7
2012
18. à Network 4
102
Wärtsilä Finland Oy
Training material for Siemens S7
2012
19. à Network 5
Wärtsilä Finland Oy
103
Training material for Siemens S7
2012
20. à Networks 6-7
104
Wärtsilä Finland Oy
Training material for Siemens S7
2012
OB1 21. Finally open your OB1 and update it to as follows: à Networks 1-2
Wärtsilä Finland Oy
105
Training material for Siemens S7
2012
Networks 3-4
106
Wärtsilä Finland Oy
Training material for Siemens S7
2012
Network 5-6
Wärtsilä Finland Oy
107
Training material for Siemens S7
2012
ÎÎ Network 7 can be copied from Sample project zEn23_01_FMx50-‘s OB1
108
Wärtsilä Finland Oy
Training material for Siemens S7
2012
Network 7
Wärtsilä Finland Oy
109
Training material for Siemens S7
2012
Networks 8-9
110
Wärtsilä Finland Oy
Training material for Siemens S7
2012
23. Exercise 6: MyPID In the next exercise we’ll 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 ––Drum’s diameter 0.5 m ––Drum’s height 1.0 m zzEngine load is tuned with PIW288 zzGain (P), Reset time (I) and Tank level SP [0-100%] are user inputs.
Wärtsilä Finland Oy
111
Training material for Siemens S7
2012
24. Solution 6: MyPID DB200 Project constants
112
Wärtsilä Finland Oy
Training material for Siemens S7
2012
FB14 Astia 1. à Sources à Insert New Object à SCL Source
2. Rename it to Astia
Wärtsilä Finland Oy
113
Training material for Siemens S7
2012
3. Open your Astia Source File
4. After this, open Astia.txt
114
Wärtsilä Finland Oy
Training material for Siemens S7
2012
5. à Edit à Select All à Copy
Wärtsilä Finland Oy
115
Training material for Siemens S7
2012
6. Paste the contents of Astia.txt to Astia.scl
116
Wärtsilä 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
Wärtsilä Finland Oy
117
Training material for Siemens S7
2012
FB8 MyPID 11. Variables for FB8
118
Wärtsilä Finland Oy
Training material for Siemens S7
2012
12. à Network 1
Wärtsilä Finland Oy
119
Training material for Siemens S7
2012
13. à Networks 2-3
120
Wärtsilä Finland Oy
Training material for Siemens S7
2012
14. à Network 4
Wärtsilä Finland Oy
121
Training material for Siemens S7
2012
15. à Network 5 (à Libraries à Standard Library à PID Control Blocks)
122
Wärtsilä Finland Oy
Training material for Siemens S7
Wärtsilä Finland Oy
2012
123
Training material for Siemens S7
2012
16. à Networks 6-7
124
Wärtsilä Finland Oy
Training material for Siemens S7
2012
17. à Networks 8-9
Wärtsilä Finland Oy
125
Training material for Siemens S7
2012
18. à Network 10
OB1 19. à Network 10
126
Wärtsilä Finland Oy
Training material for Siemens S7
2012
25. Exercise 7: ModbusTCP
25. Exercise 7: ModbusTCP Hello!
What’s your name?
I’m CPU 315-PN/DP.
Can us two lonely souls someday become one?
???
Wärtsilä Finland Oy
Hello.
I’m VAMP 210. What’s yours?
OK, whatever…
You have to ”do” me first…
Configure a standardised MODBUS/TCP communication prototol for me.
127
Training material for Siemens S7
2012
thefifinal exercise we’ll ModbusTCP connection for VAMP 210 Generator Protection InInthe nal exercise we’llconfigure configurea a ModbusTCP connection for VAMP 210 Generator Protection Relay. Relay. Protocols are are used data between heterogeneous communication partners. In this In this Protocols usedwhen whenexchanging exchanging data between heterogeneous communication partners. exercise we we are are using protocol. TheThe controller, generator protection relay and operator exercise usingModbusTCP ModbusTCP protocol. controller, generator protection 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 IP Address: 192.168.0.1
S7 Connection
128
VAMP 210 IP Address: 192.168.0.17
Beijer E1101 HMI IP Address: 192.168.0.120
Wärtsilä 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 wewant wantananillustration illustration “Alive indicator” value VAMP 210our into ourscreen. HMI screen. Now of of thethe “Alive indicator” value fromfrom VAMP 210 into HMI
DB121.DBW32
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
3. Open FB17 Communication and modify it as follows
ÎÎ Network 1
Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
ÎÎ Networks 3 & 4
Wärtsilä Finland Oy
133
Training material for Siemens S7
2012
DB22 DDR_DB where value valuefor forstring stringvariable variable is set. do the following 4.4. Open Open DB22 DDR_DBand andlocate locate row row where IP3IP3 is set. ThenThen do the modifications following modifications
Register type. TRUE = Input register, FALSE = Holding register. Input register Holding register
(3xxxx) (4xxxx)
ÎÎ Note! changingInitial Initialvalues, values, remember to Initialize Data Block. Note! When When changing remember to Initialize Data Block. à Data View View View View à Data à InitializeData DataBlock Block Edit Edit à Initialize
134
Wärtsilä Finland Oy
Training material for Siemens S7
2012
5. OB1
ÎÎ Network 11
Wärtsilä 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
Wärtsilä 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 wewant wanttotochange change address of Alive indicator from DB121.DBW20 to DB121.DBW32, we Now when thethe address of Alive indicator from DB121.DBW20 to DB121.DBW32, have to change the 16#07C1 (1985). we have to change thevalue valueofofDB_HOLD_ADD DB_HOLD_ADD toto16#07C1 (1985).
Wärtsilä Finland Oy
137
Training material for Siemens S7
2012
When opening DB121 we DB121 see that thethat Alive is then written totoDB121.DBW32. When opening we see theindicator Alive indicator is then written DB121.DBW32.
Remember,that thatwe wearen’t aren’t now actually reading addresses 401987 … 401990, we have set Remember, now actually reading addresses 401987 … 401990, because because we have set START_ADDR 1991 in DB22. START_ADDR to to 1991 in DB22.
138
Wärtsilä 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. Wärtsilä 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
Wärtsilä Finland Oy
Training material for Siemens S7
Wärtsilä Finland Oy
2012
141
Training material for Siemens S7
2012
Modbus “Alive indicator” from VAMP 210
142
Wärtsilä 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?
Wärtsilä Finland Oy
143
Training material for Siemens S7
2012
1. à Blocks à Reference Data à Display
2. Press Yes
144
Wärtsilä Finland Oy
Training material for Siemens S7
2012
3. OK
4. Press Filter
Wärtsilä Finland Oy
145
Training material for Siemens S7
2012
5. Activate DBs. Press OK.
146
Wärtsilä Finland Oy
Training material for Siemens S7 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
Wärtsilä Finland Oy
2012
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
Wärtsilä Finland Oy
Training material for Siemens S7
2012
4. Press OK
5. Create a new folder and name it.
Wärtsilä Finland Oy
149
Training material for Siemens S7
2012
6. Archive your project
? Wärtsilä PLC backups are named as follows: PLC_YYMMDD_PROJECTN.ZIP 7. Name your .zip –file and press ADD
150
Wärtsilä Finland Oy
Training material for Siemens S7
2012
8. Press OK
9. Done!
Wärtsilä Finland Oy
151
Wärtsilä is a global leader in complete lifecycle power solutions for the marine and energy markets. By emphasising technological innovation and total efficiency, Wärtsilä maximises the environmental and economic performance of the vessels and power plants of its customers. Wärtsilä is listed on the NASDAQ OMX Helsinki, Finland.
WÄRTSILÄ® is a registered trademark. Copyright © 2012 Wärtsilä Corporation.
View more...
Comments