Navigating the world of automation
2011 Automation Summit Orlando, FL
Navigating the world of automation
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Page 2
2011 Automation Summit
Title: Top Ten Programming Mistakes Made by People New to S7
Track:#56
Topic: Learn about some of the common problems experienced by people learning S7.
Presenter: Tim Jager
Company: DMC
Top Ten Programming Mistakes Made by People New to S7
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top Ten Programming Mistakes Made by People New to S7
Page 3
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
30 Employees
Company Profile
Since 1996
Based In Chicago…
…but work Globally
DMC has the highest number of S7 certified engineers
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Our customers
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Manufacturing and Automation IntelligenceMicrosoft SharePoint Consulting ServicesTest and MeasurementCustom Software Engineering & Embedded Systems
Areas of Expertise
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Dulles Airport Transit Tunnel Ventilation System WinCC Redundancy S7 400H Redundant PLC 4000 I/O Points
Relevant Siemens Projects
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Batch Mixing Systems for Confectionary Company
S7-300 Standardized code base Deployment at multiple facilities Mixing/batching control Recipe management Web-based reporting system
Relevant Siemens Projects
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Automotive Assembly Lines for Tier 1 Supplier
S7 400 PLC’s WinCC Flex HMI’s Standardized code base User Configurable JIT - Lean Manufacturing Deployment at multiple facilities
Relevant Siemens Projects
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
US Navy LCS-1
Littoral Combat Ship S7 400H Redundant PLC
Mission Critical Logic
Relevant Siemens Projects
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Presenter Info
Tim Jager
Project Director at DMC
Mechanical Engineer (University of Illinois)
Licensed Professional Engineer in Illinois
With DMC since 1999
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
#1Page 12
Simple Hardware mistakes
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Common Hardware Mistakes
Page 13
My PLC Doesn’t Work???
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Common Hardware Mistakes
Page 14
It needs a memory card
My PLC Doesn’t Work???
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Common Hardware Mistakes
Page 15
It needs a memory card
It’s in STOP Mode
My PLC Doesn’t Work???
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Common Hardware Mistakes
Page 16
I wonder what’s on the MMC Card?
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Common Hardware Mistakes
Page 17
I wonder what’s on the MMC Card?
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Common Hardware Mistakes
Page 18
I wonder what’s on the MMC Card?
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Common Hardware Mistakes
Page 19
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Common Hardware Mistakes
Page 20
This is not an RS232 Serial Port!!!
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
#2Page 21
Using Absolute Address Priority instead of Symbolic
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Set your Address Priority to Symbolic
You Just took the Red pill…. You are on your way down the rabbit hole that leads down the path of true object oriented PLC Programming.
Page 22
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
A Typical Data Block
DB1 “dbGlobals”
Page 23
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
A Typical Data Block
DB1 “dbGlobals”
Page 24
Address:
DB1.DBX0.0
Symbol Name:
“dbGlobals”.bStart
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
A Typical Rung Of Ladder
Page 25
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
A Typical Rung Of Ladder
Page 26
Address Logic
Symbolic Logic
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
A Typical Rung Of Ladder
Page 27
Address Logic
Symbolic Logic
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
What happens if we change the Data Block?
Page 28
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Absolute vs. Symbolic Priority
Page 29
In Symbolic Mode the intended logic is maintained
The address logic has changed from 0.1 to 0.2
The symbolic logic is maintained
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Absolute vs. Symbolic Priority
Page 30
But the Symbolic logic is totally wrong!
The Address logic is maintained
In Absolute Mode the intended logic is NOT maintained!
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Absolute vs. Symbolic Priority
Page 31
Absolute Address
2222N. Elston Ave
Chicago, IL 60614
Symbolic Address
VS.
You don’t have to know where the server lives or it’s IP address. You just need the symbolic name to send an email.
So start forgetting about addresses and start thinking about symbolic names.
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
#3Page 32
I/O Mapping
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
…I'M GONNA PROGRAM… LIKE IT'S 1999
Page 33
Input / Output Mapping
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Traditional Input / Output Mapping
Page 34
1. At the beginning of the scan, Each physical input gets mapped to an internal variable…
Physical Input
Internal Variable
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Traditional Input / Output Mapping
Page 35
1. At the beginning of the scan, Each physical input gets mapped to an internal variable…
2. Now run all of the logic (which references only internal bits)…
Internal Variable
Internal Variable
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Traditional Input / Output Mapping
Page 36
1. At the beginning of the scan, Each physical input gets mapped to an internal variable…
2. Now run all of the logic (which references only internal bits)…
3. …At the end of the scan, internal “output” bits get mapped to physical outputs
Internal Variable
Physical Output
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Page 37
S7 I/O Mapping – Just use the Symbol Table
Make sure you are in Symbolic Priority Mode
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
#4Page 38
Improper Use of Bit Memory
AKA: Mbits
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Page 39
M0.0M0.1M0.2M0.3M0.4M0.5M0.6M0.7M1.0M1.1M1.2M1.3M1.4M1.5M1.6M1.7M2.0M2.1M2.2M2.3M2.4M2.5M2.6M2.7M3.0M3.1M3.2M3.3M3.4M3.5M3.6M3.7
M0.0 – M0.7
M1.0 – M1.7
M2.0 – M2.7
M2.0 – M2.7
MBits
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Page 40
M0.0M0.1M0.2M0.3M0.4M0.5M0.6M0.7M1.0M1.1M1.2M1.3M1.4M1.5M1.6M1.7M2.0M2.1M2.2M2.3M2.4M2.5M2.6M2.7M3.0M3.1M3.2M3.3M3.4M3.5M3.6M3.7
MB0M0.0 – M0.7
M1.0 – M1.7
M2.0 – M2.7
M2.0 – M2.7
MB1
MB2
MB3
MBits MBytes
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Page 41
M0.0M0.1M0.2M0.3M0.4M0.5M0.6M0.7M1.0M1.1M1.2M1.3M1.4M1.5M1.6M1.7M2.0M2.1M2.2M2.3M2.4M2.5M2.6M2.7M3.0M3.1M3.2M3.3M3.4M3.5M3.6M3.7
MB0M0.0 – M0.7
M1.0 – M1.7
M2.0 – M2.7
M2.0 – M2.7
MB1
MB2
MB3
MBits MBytes
MW0
MWords
MW1
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Page 42
M0.0M0.1M0.2M0.3M0.4M0.5M0.6M0.7M1.0M1.1M1.2M1.3M1.4M1.5M1.6M1.7M2.0M2.1M2.2M2.3M2.4M2.5M2.6M2.7M3.0M3.1M3.2M3.3M3.4M3.5M3.6M3.7
MB0M0.0 – M0.7
M1.0 – M1.7
M2.0 – M2.7
M2.0 – M2.7
MB1
MB2
MB3
MBits MBytes
MW0
MWords
MW1
MD0
MDoubleWords
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
When is it OK to use M Bits?
• Debugging• Quick prototyping / demonstrations• When you absolutely have to!
Page 43
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
When is it OK to use M Bits?
Page 44
M-Bits
• Critical / Time-sensitive field fixes*
* As long as you promise to put in a permanent fix when the heat is off.
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
When is it OK to use M Bits?
Page 45
If you use MBits, make sure they are NOT IN USE already.
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
When is it OK to use M Bits?
..and make sure to add symbol names in the symbol table.
Page 46
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
When is it OK to use M Bits?
Or suffer the consequences……
Page 47
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
When is it OK to use M Bits?
•Clock Byte
Page 48
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
#5Page 49
Not using or Improperly using the Clock Byte
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
What is the Clock Byte?
Page 50
Bit of the Clock Memory Byte 7 6 5 4 3 2 1 0Period Duration (s) 2.0 1.6 1.0 0.8 0.5 0.4 0.2 0.1Frequency (Hz) 0.5 0.625 1 1.25 2 2.5 5 10
Each bit of the clock memory byte is assigned a frequency.
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Symbol Table Entry For Clock Byte
Page 51
Reserve these so nobody uses Memory overlapping the Clock Byte
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Clock Byte
Page 52
The bits within the Clock byte can change at any time during the scan.
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Clock Byte – Synchronous Global
Page 53
UDT1 “udtClockByte”
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Clock Byte – Synchronous Global
Page 54
DB1 “dbGlobals”
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Clock Byte – Synchronous Global
Page 55
DB1 “dbGlobals”
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Clock Byte – Synchronous Global
Page 56
DB1 “dbGlobals”
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Clock Byte – Synchronous Global
Page 57
MB0 dbGlobals.ClockByte
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Page 58
M0.0
M0.1
M0.2
M0.3
M0.4
M0.5
M0.6
M0.7
“Always_False”
Mapped to M0.0
“Always_True”
Mapped to M0.1
What Happens If……
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Page 59
M0.0
M0.1
M0.2
M0.3
M0.4
M0.5
M0.6
M0.7
Clock Byte
Mapped to MB0
“Always_False”
Mapped to M0.0
“Always_True”
Mapped to M0.1
What Happens If……
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Overlapping Mbits are BAD!
Page 60
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
#6Page 61
Using Uninitialized Temp Memory
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
What is Temp Memory?
Page 62
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Improper Use of Temp Memory
Page 63
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Improper Use of Temp Memory
Page 64
Don’t read from a TEMP unless you have written to it first!
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
#7Page 65
Not Using Timed Interrupts.
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
OB1 vs. OB30..38
Page 66
OB1
Runs as fast as it can.
OB30…OB38
Run at specific time intervals.
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Timed Interrupts OB30..OB38
Page 67
PID Control Data Sampling
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
#8Page 68
Not using reusable function blocks
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
A Function Block is a piece of reusable code that consists of:
Code is encapsulated in a Highly reusable form
Increases Programming efficiency and reduces errors
What is a Function Block
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
One of the simplest and most commonly used function block is a
Timer.
TON
IN
T#200ms PT ET 178
Q
Timer
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Creation of Function Block
Isolate Common/Duplicate Code
If the same code is used many times in your program, consider creating function blocks.
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Step 1. locate common code.
Creation of Function Block
Isolate Common/Duplicate Code
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Step 1. locate common code.
Creation of Function Block
Isolate Common/Duplicate Code
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Step 2. Replace duplicated code with function blocks.
Creation of Function Block
Isolate Common/Duplicate Code
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Custom FB ExamplesMotor
FB
Pump
FB
Cylinder
FB
Barcode Scanner
FB
Label Printer
FB
Valve
FB
Machine Vision
FB
Robot Interface
FB
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
#9Page 76
Inconsistent Blocks
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Check Block Consistency
Page 77
Don’t forget to download the Data Block!!
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
Page 78
And last but not least……..
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Top 10 S7 Mistakes
#10Page 79
Going it Alone
Navigating the world of automation Copyright © Siemens Industry, Inc. 2011. All rights reserved.
Thank You!
Page 80