80
Navigating the world of automation 2011 Automation Summit Orlando, FL Navigating the world of automation

Dmcsiemenssummit2011 Toptenprogrammingmistakesslideshare 110713160157 Phpapp01

Embed Size (px)

DESCRIPTION

electronica

Citation preview

DMC Siemens Summit 2011 - Top Ten Programming Mistakes Made by People New to Siemens

2011 Automation Summit Orlando, FL

Navigating the world of automation

Navigating the world of automationNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.1Page 22011 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.2Top Ten Programming Mistakes Made by People New to S7Page 3

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.330 Employees Company ProfileSince 1996

Based In Chicagobut work Globally DMC has the highest number of S7 certified engineers

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.4

Our customers

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.5 Automotive Chemical Food Processing Electronics/SemiconductorLaboratory Testing Machine Tool Material Handling Converting Packaging Pharmaceutical Printing & Textiles

Manufacturing and Automation Intelligence

Microsoft SharePoint Consulting Services

Test and Measurement

Custom Software Engineering & Embedded SystemsAreas of Expertise

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.6Dulles Airport Transit Tunnel Ventilation SystemWinCC RedundancyS7 400H Redundant PLC4000 I/O Points

Relevant Siemens Projects

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.7

Batch Mixing Systems for Confectionary Company

S7-300Standardized code baseDeployment at multiple facilities Mixing/batching controlRecipe managementWeb-based reporting system

Relevant Siemens Projects

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.8

Automotive Assembly Lines for Tier 1 Supplier

S7 400 PLCsWinCC Flex HMIsStandardized code baseUser ConfigurableJIT - Lean ManufacturingDeployment at multiple facilities

Relevant Siemens Projects

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.9

US Navy LCS-1 Littoral Combat ShipS7 400H Redundant PLCMission Critical LogicRelevant Siemens Projects

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.10Presenter InfoTim JagerProject Director at DMCMechanical Engineer (University of Illinois)Licensed Professional Engineer in IllinoisWith DMC since 1999

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.11Top 10 S7 Mistakes#1Page 12Simple Hardware mistakesNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.12Common Hardware MistakesPage 13

My PLC Doesnt Work???Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.13Common Hardware MistakesPage 14

It needs a memory cardMy PLC Doesnt Work???Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.14Common Hardware MistakesPage 15

It needs a memory cardIts in STOP ModeMy PLC Doesnt Work???Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.15Common Hardware MistakesPage 16

I wonder whats on the MMC Card?Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.16Common Hardware MistakesPage 17

I wonder whats on the MMC Card?

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.17Common Hardware MistakesPage 18

I wonder whats on the MMC Card?

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.18Common Hardware MistakesPage 19

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.19Common Hardware MistakesPage 20

This is not an RS232 Serial Port!!!Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.20Top 10 S7 Mistakes#2Page 21Using Absolute Address Priority instead of SymbolicNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.21Set your Address Priority to SymbolicYou 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.22A Typical Data BlockDB1 dbGlobalsPage 23

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.23A Typical Data BlockDB1 dbGlobalsPage 24

Address: DB1.DBX0.0Symbol Name: dbGlobals.bStartNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.24

A Typical Rung Of LadderPage 25Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.25

A Typical Rung Of LadderPage 26Address LogicSymbolic LogicNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.26

A Typical Rung Of LadderPage 27Address LogicSymbolic Logic

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.27What happens if we change the Data Block?Page 28

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.28Absolute vs. Symbolic PriorityPage 29

In Symbolic Mode the intended logic is maintainedThe 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.29

Absolute vs. Symbolic PriorityPage 30But 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.30Absolute vs. Symbolic PriorityPage 31

Absolute Address2222N. Elston AveChicago, IL 60614Symbolic [email protected] dont have to know where the server lives or its 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.31Top 10 S7 Mistakes#3Page 32I/O MappingNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.32I'm gonna Program like it's 1999Page 33Input / Output MappingNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.33Traditional Input / Output MappingPage 34

1. At the beginning of the scan, Each physical input gets mapped to an internal variablePhysical InputInternal VariableNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.34Traditional Input / Output MappingPage 351. At the beginning of the scan, Each physical input gets mapped to an internal variable2. Now run all of the logic (which references only internal bits)

Internal VariableInternal VariableNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.35Traditional Input / Output MappingPage 361. At the beginning of the scan, Each physical input gets mapped to an internal variable2. 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 VariablePhysical OutputNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.36Page 37

S7 I/O Mapping Just use the Symbol TableMake sure you are in Symbolic Priority ModeNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.37Top 10 S7 Mistakes#4Page 38Improper Use of Bit MemoryAKA: MbitsNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.38Page 39M0.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.7M0.0 M0.7M1.0 M1.7M2.0 M2.7M2.0 M2.7MBitsNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.39Page 40M0.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.7MB0M0.0 M0.7M1.0 M1.7M2.0 M2.7M2.0 M2.7MB1MB2MB3MBitsMBytesNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.40Page 41M0.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.7MB0M0.0 M0.7M1.0 M1.7M2.0 M2.7M2.0 M2.7MB1MB2MB3MBitsMBytesMW0MWordsMW1Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.41Page 42M0.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.7MB0M0.0 M0.7M1.0 M1.7M2.0 M2.7M2.0 M2.7MB1MB2MB3MBitsMBytesMW0MWordsMW1MD0MDoubleWordsNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.42When is it OK to use M Bits?DebuggingQuick prototyping / demonstrationsWhen you absolutely have to! Page 43Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.43When is it OK to use M Bits?Page 44

M-BitsCritical / 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.44When is it OK to use M Bits?Page 45If you use MBits, make sure they are NOT IN USE already.

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.45When 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.46When 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.47When is it OK to use M Bits?Clock Byte Page 48Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.48Top 10 S7 Mistakes#5Page 49Not using or Improperly using the Clock ByteNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.49What is the Clock Byte?Page 50Bit of the Clock Memory Byte76543210Period Duration (s)2.01.61.00.80.50.40.20.1Frequency (Hz)0.50.62511.2522.5510Each bit of the clock memory byte is assigned a frequency.

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.50Symbol Table Entry For Clock BytePage 51

Reserve these so nobody uses Memory overlapping the Clock ByteNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.51Clock BytePage 52The 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.52Clock Byte Synchronous GlobalPage 53UDT1 udtClockByte

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.53Clock Byte Synchronous GlobalPage 54

DB1 dbGlobalsNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.54Clock Byte Synchronous GlobalPage 55

DB1 dbGlobals

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.55Clock Byte Synchronous GlobalPage 56

DB1 dbGlobalsNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.56Clock Byte Synchronous GlobalPage 57

MB0dbGlobals.ClockByteNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.57Page 58M0.0M0.1M0.2M0.3M0.4M0.5M0.6M0.7Always_FalseMapped to M0.0Always_TrueMapped to M0.1What Happens If Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.58Page 59M0.0M0.1M0.2M0.3M0.4M0.5M0.6M0.7Clock Byte Mapped to MB0Always_FalseMapped to M0.0Always_TrueMapped to M0.1What Happens If Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.59Overlapping Mbits are BAD!Page 60

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.60Top 10 S7 Mistakes#6Page 61Using Uninitialized Temp MemoryNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.61

What is Temp Memory?Page 62Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.62Improper Use of Temp MemoryPage 63

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.63Improper Use of Temp MemoryPage 64

Dont read from a TEMP unless you have written to it first!Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.64Top 10 S7 Mistakes#7Page 65Not Using Timed Interrupts.Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.65OB1 vs. OB30..38Page 66OB1 Runs as fast as it can.OB30OB38 Run at specific time intervals.

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.66Timed Interrupts OB30..OB38Page 67PID Control

Data SamplingNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.67Top 10 S7 Mistakes#8Page 68Not using reusable function blocksNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.68A Function Block is a piece of reusable code that consists of:

Code is encapsulated in a Highly reusable formIncreases Programming efficiency and reduces errors

What is a Function Block Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.69One of the simplest and most commonly used function block is a Timer.TONINT#200msPTET178QTimer

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.70Creation of Function BlockIsolate Common/Duplicate CodeIf 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.71Step 1. locate common code.Creation of Function BlockIsolate Common/Duplicate CodeNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.72Step 1. locate common code.Creation of Function BlockIsolate Common/Duplicate CodeNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.73

Step 2. Replace duplicated code with function blocks.Creation of Function BlockIsolate Common/Duplicate CodeNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.74Custom FB ExamplesMotorFB

PumpFB

CylinderFB

Barcode ScannerFBLabel PrinterFBValveFB

Machine VisionFBRobot InterfaceFB

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.75Top 10 S7 Mistakes#9Page 76Inconsistent BlocksNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.76Check Block ConsistencyPage 77Dont forget to download the Data Block!!

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.77Top 10 S7 MistakesPage 78And last but not least..Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.78Top 10 S7 Mistakes#10Page 79Going it AloneNavigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.79Thank You!Page 80

Navigating the world of automation Copyright Siemens Industry, Inc. 2011. All rights reserved.80