Training Material for Siemens S7 2012

download Training Material for Siemens S7 2012

of 152

description

Training Material for Siemens S7 2012

Transcript of Training Material for Siemens S7 2012

  • TRAINING MATERIAL FOR SIEMENS S72012

    Erno Salonen WFI-TSDocID: DBAC159168Revision: d

    INTERNAL USE ONLY

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy2

    Kids, you tried your best and you failed miserably. The lesson is, never try.

    Homer J. Simpson

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 3

    Contents01. 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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy4

    01. General

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

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

    zz This 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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 5

    03. Training equipment

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy6

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 7

    04. Simatic Manager

    Overview of Simatic Manager

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy8

    05. Starting of Simatic ManagerSimatic Manager can be started in two ways:

    1. double-click Simatic Manager icon on the desktop

    2. or start Simatic Manager from Start menu

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 9

    05.1 First viewView when opening Simatic Manager

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy10

    05.2 Storage location for projects and multiprojectsOptions Customize

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 11

    05.3 Set PG/PC interface Communication with Simatic S7 PC adapter USBSimatic S7 PC adapter USB (Material number PAAE093507)

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy12

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

    zz Options Set PG/PC Interface

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 13

    zz Select PC Adapter(MPI)

    zz Press OK

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy14

    zz Press Accessible nodes

    zz Open Blocks

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

    z Now you are ready to start your exercise!

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 15

    05.4 Starting a new S7 projectzz File New

    zz Write your project name to Name:

    zz Press OK

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy16

    05.5 Inserting S7 program

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

    zz Press F2 or mouse right-click and Rename

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 17

    06. Hardware configuration

    Hardware used in our exercise

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy18

    06.1 Inserting Simatic 300 Station

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

    zz Press F2 or mouse right-click and Rename

    06.2 Starting HW Config

    zz Double-click Simatic 300

    zz Double-click Hardware symbol

    z HW Config is now opened

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 19

    zz To open/close Hardware Catalog press

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy20

    07. Making HW Config for our project1. Double-click Rail from Catalog

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 21

    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.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy22

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 23

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy24

    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.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 25

    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.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy26

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 27

    11. Press Save and close window.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy28

    zz 12. Press Save and Compile

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 29

    7. Download HW Config to CPU

    8. Press OK.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy30

    9. Press OK.

    10. Press OK.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 31

    11. Press Yes.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy32

    08. Set PG/PC interface Communication with ethernetIf 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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 33

    2. Define your laptop IP address as follows

    3. Press OK

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy34

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

    5. Options Set PG/PC Interface

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 35

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy36

    09. Some CPU settingszz Start HW Config

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

    zz Put Scan cycle monitoring time [ms]: 150

    zz Enable Clock memory and put Memory Byte: 10

    z 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.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 37

    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

    zz Press OK

    zz Save and Compile

    zz Download to module

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy38

    10. Symbol tablezz Double-click Symbols

    zz Write I0.0 to Address

    zz Write Start to Symbol

    zz Write Engine start to Comment

    zz Press Enter

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

    zz Press Save

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 39

    11. Variable tableNext we will test the inputs and outputs of Training equipment.

    zz Insert new Variable Table

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy40

    zz Give Symbolic Name and Symbol Comment to your Variable table and press OK

    zz Open Variable table

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 41

    zz Press to start monitoring variables

    zz First test your inputs one by one

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy42

    Output testing is done the following way:

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

    zz Right click mouse Activate modify value

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 43

    zz Press to start monitoring modified values

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

    zz Right-click mouse Activate modify value

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy44

    12. Exercise 1: FB1 JoggingNow we can do our first program. Do the jogging function for rail.

    zz Rail should start when pressing start button

    zz Rail direction can be changed from engine control remote/local switch (remote=LEFT, local=Right)

    zz Rail speed should be slow

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 45

    13. Solution 1: FB1 Jogging1. Insert new object

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy46

    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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 47

    5. Then do the following networks:

    Network 1

    Network 2

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy48

    Network 3

    6. Press Save

    7. Press Download

    z Remember to check PQW352 settings in HW Config

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 49

    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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy50

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

    13. Test your project

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 51

    14. Exercise 2: FB2 Truncated coneNext we will calculate the volume of truncated cone.

    zz Volume V can be calculated from the following formula:

    zz Where h = 5 R = 3 r = 1

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy52

    15. Solution 2: FB2 Truncated cone1. This exercise is done with STL

    First define the following Variables

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 53

    Networks 1 and 2

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy54

    Network 3

    2. Press Save

    3. Press Download

    4. Test your project

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 55

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy56

    z ? 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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 57

    8. Open your OB1 and add FB2 to Network 2

    9. Write DB2 to ??? and press Enter

    10. Press Yes

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy58

    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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 59

    16. Exercise 3: FB3 Using timer functionsNext well look into timers. We will test the following timers:

    zz Pulse timer TP

    zz On-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.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy60

    17. Solution 3: FB3 Using timer functions1. First do the STAT variables:

    zz Write TON1 and write data type sfb4. press Enter

    zz Write TP1 and write data type sfb3. press Enter

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 61

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy62

    3. Networks 1, 2 and 3

    Note! Remember to write these also to Symbol Table

    M30.0 M30.1 M30.2

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 63

    18. Exercise 4: Tourist BUS

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

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

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

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

    zz Bus speed is tuned from PIW288.

    zz Bus speed is limited to 40% of the maximum speed.

    Stop 1

    Stop 2

    Stop 3

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy64

    M500.0 M500.1 M500.2

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 65

    19. Solution 4: Tourist BUSzz We will do this excercise with three functions blocks:

    z FB5 Main control for rail (FBD)

    z FB4 Sightseeing (Graph)

    z FB19 Analog I/O (FBD)

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

    z FB110 M_SCIRHHLL

    z FC79 AO_SCALE

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy66

    FB5 Main control for rail

    1. Lets start with FB5 Main control for rail

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 67

    Networks 1-3

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy68

    Networks 4-6

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 69

    Networks 7-8

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy70

    Networks 9-10

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 71

    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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy72

    4. Call FC79 in network 2

    z Remember to check PIW288 Settings in HW Config

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 73

    FB4 Sightseeing

    5. FB4 Sightseeing is done with GRAPH

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy74

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 75

    7. Insert Drag-and-Drop

    8. Select Step + Transition and place it after S1

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy76

    9. Like this!

    10. Select Insert AND Box

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 77

    11. Place it to Transition T1

    12. Write I0.0 to ??.?

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy78

    13. Insert Action

    14. And place it to Step1

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 79

    15. Write R to ?

    16. Write M59.2 to ???

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy80

    M59.2

    17. Result should like this:

    I0.0 M59.1

    M51.0

    M59.3

    I0.6

    NEG!

    NEG!

    M56.0M51.1

    M52.0M56.0

    M52.1

    M59.6

    M59.5

    M59.3

    I0.6

    I0.7

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 81

    NEG!

    NEG!

    M53.0I1.0

    I0.7

    M59.6

    M59.5

    M59.0

    M59.0

    M53.1

    M54.0

    M54.1

    M59.2

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy82

    18. Finally, add FB4, FB5 and FB19 to OB1. Add also HMI control memory bits M500.0 and M500.1 to OB1.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 83

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy84

    20. Check Block ConsistencyNow it is a good time to compile our project.

    1. Check Block Consistency

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 85

    2. Compile all

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy86

    3. Result should look like this:

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 87

    4. Download your project to PLC.

    5. Test your project.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy88

    21. Exercise 5: Machine toolIn 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.

    zz Acceleration function is done automatically by the frequency converter.

    zz In this exercise we will be using for the first time also SCL (Structured Control Language) programming.

    zz The deceleration ramp is done with Wrtsil Standard block Curvexy.

    User input here!

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 89

    22. Solution 5: Machine toolDB200 Project constants

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy90

    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)

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 91

    FB13 Positioner

    1. Insert new SCL Source

    2. Rename it to Positioner and open it

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy92

    3. Insert Block Template FB

    4. Empty block template inserted

    5. Write your SCL code as follows:

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 93

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy94

    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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 95

    FB6 Machine tool

    10. Variables for FB6

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy96

    11. Networks 1-2

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 97

    12. Network 3

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy98

    FB7 Ramp

    13. Variables for FB7

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 99

    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.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy100

    16. Network 1

    16. Network 1

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 101

    17. Networks 2-3

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy102

    18. Network 4

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 103

    19. Network 5

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy104

    20. Networks 6-7

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 105

    OB1

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

    Networks 1-2

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy106

    Networks 3-4

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 107

    Network 5-6

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy108

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 109

    Network 7

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy110

    Networks 8-9

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 111

    23. Exercise 6: MyPIDIn the next exercise well control the Diesel oil level in the Day-tank.

    zz Tank specification:

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

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

    z Pressure at inlet pipe 1.0 bar

    z Density of Diesel oil 900 kg/m3

    z Drums diameter 0.5 m

    z Drums height 1.0 m

    zz Engine load is tuned with PIW288

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy112

    24. Solution 6: MyPIDDB200 Project constants

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 113

    FB14 Astia

    1. Sources Insert New Object SCL Source

    2. Rename it to Astia

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy114

    3. Open your Astia Source File

    4. After this, open Astia.txt

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 115

    5. Edit Select All

    Copy

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy116

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 117

    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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy118

    FB8 MyPID

    11. Variables for FB8

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 119

    12. Network 1

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy120

    13. Networks 2-3

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 121

    14. Network 4

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy122

    15. Network 5

    ( Libraries Standard Library PID Control Blocks)

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 123

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy124

    16. Networks 6-7

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 125

    17. Networks 8-9

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy126

    18. Network 10

    OB1

    19. Network 10

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 127

    25. Exercise 7: ModbusTCP25. Exercise 7: ModbusTCP

    Hello! Hello.

    Whats your name?

    Im CPU 315-PN/DP.

    Can us two lonely souls someday become one?

    ???

    Im VAMP 210. Whats yours?

    OK, whatever

    You have to do me first

    Configure a standardised MODBUS/TCP communication prototol for me.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy128

    In the fi nal exercise well confi gure a ModbusTCP connection for VAMP 210 Generator Protection Relay.

    Protocols are used when exchanging data between heterogeneous communication partners. In this exercise we are using ModbusTCP protocol. The controller, generator protection relay and operator panel are located in the same IP subnet. Therefore a gateway is not needed.

    Schematic layout in our project

    In the final exercise well configure a ModbusTCP connection for VAMP 210 Generator Protection Relay.

    Protocols are used when exchanging data between heterogeneous communication partners. In this exercise we are using ModbusTCP protocol. The controller, generator protection relay and operator panel are located in the same IP subnet. Therefore a gateway is not needed.

    Schematic layout in our project

    Ethernet

    CPU 315-2PN/DP IP Address: 192.168.0.1

    Beijer E1101 HMI IP Address: 192.168.0.120

    VAMP 210 IP Address: 192.168.0.17

    Modbus

    S7 Connection

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 129

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

    Now we want an illustration of the Alive indicator value from VAMP 210 into our HMI screen.

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

    Now we want an illustration of the Alive indicator value from VAMP 210 into our HMI screen.

    DB121.DBW32

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy130

    26. Solution 7: ModbusTCPOB100 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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 131

    3. Open FB17 Communication and modify it as follows

    z Network 1

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy132

    z 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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 133

    z Networks 3 & 4

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy134

    4. Open DB22 DDR_DB and locate row where value for string variable IP3 is set. Then do the following modifications

    z Note! When changing Initial values, remember to Initialize Data Block. View Data View Edit Initialize Data Block

    4. Open DB22 DDR_DB and locate row where value for string variable IP3 is set. Then do the following modifications

    Note! When changing Initial values, remember to Initialize Data Block. View Data View Edit Initialize Data Block

    Register type. TRUE = Input register, FALSE = Holding register.

    Input register (3xxxx) Holding register (4xxxx)

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 135

    5. OB1

    z Network 11

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy136

    z 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

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

    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

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 137

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

    Now when we want to change the address of Alive indicator from DB121.DBW20 to DB121.DBW32, we have to change the value of DB_HOLD_ADD to 16#07C1 (1985).

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

    Now when we want to change the address of Alive indicator from DB121.DBW20 to DB121.DBW32, we have to change the value of DB_HOLD_ADD to 16#07C1 (1985).

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy138

    When opening DB121 we see that the Alive indicator is then written to DB121.DBW32.

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

    When opening DB121 we see that the Alive indicator is then written to DB121.DBW32.

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 139

    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.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy140

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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 141

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy142

    Modbus Alive indicator from VAMP 210

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 143

    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?

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy144

    1. Blocks Reference Data Display

    2. Press Yes

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 145

    3. OK

    4. Press Filter

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy146

    5. Activate DBs. Press OK.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 147

    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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy148

    28. ArchiveNow 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

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 149

    4. Press OK

    5. Create a new folder and name it.

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy150

    6. Archive your project

    ? Wrtsil PLC backups are named as follows:

    PLC_YYMMDD_PROJECTN.ZIP

    7. Name your .zip file and press ADD

  • Training material for Siemens S7 2012

    Wrtsil Finland Oy 151

    8. Press OK

    9. Done!

  • WRTSIL is a registered trademark. Copyright 2012 Wrtsil Corporation.

    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.