Upload
others
View
25
Download
0
Embed Size (px)
Citation preview
SIMATIC PCS 7 OSx
OSx Library for S7-400 Controllers
Reference Manual
Order Number: 6ES7 6530XX048BA0Manual Assembly Number: 2811165 -- 0001Original Edition
! DANGERDANGER indicates an imminently hazardous situation that, if not avoided, willresult in death or serious injury.
DANGER is limited to the most extreme situations.
! WARNINGWARNING indicates a potentially hazardous situation that, if not avoided, couldresult in death or serious injury, and/or property damage.
! CAUTIONCAUTION used with a safety alert symbol indicates a potentially hazardous situ-ation that, if not avoided, could result in minor or moderate injury.
CAUTIONCAUTION used without the safety alert symbol indicates a potentiallyhazardous situation that, if not avoided, could result in property damage.
NOTICENOTICE indicates a potential situation that, if not avoided, could result in anundesirable result or state.
Copyright 2002 by Siemens Energy & Automation, Inc.All Rights Reserved — Printed in USA
Reproduction, transmission, or use of this document or contents is not permitted without express consent of Siemens Energy &Automation, Inc. All rights, including rights created by patent grant or registration of a utility model or design, are reserved.
Since Siemens Energy & Automation, Inc., does not possess full access to data concerning all of the uses and applications ofcustomer’s products, we do not assume responsibility either for customer product design or for any infringements of patents or rightsof others which may result from our assistance.
MANUAL PUBLICATION HISTORY
SIMATIC PCS 7 OSx Library for S7-400 Controllers Reference ManualOrder Manual Number: 6ES7 6530XX048BA0Refer to this history in all correspondence and/or discussion about this manual.
Event Date Description
O r iginal Is s ue 7/02 O r iginal Is s ue ( 2811165 -- 0001)
LIST OF EFFECTIVE PAGES
Pages Description Pages Description
Cover/Copyright OriginalHistory/Effective Pages Originaliii — xxvii Original1-1 — 1-33 Original2-1 — 2-37 Original3-1 — 3-47 Original4-1 — 4-27 Original5-1 — 5-40 Original6-1 — 6-16 Original7-1 — 7-21 Original8-1 — 8-40 Original9-1 — 9-13 Original10-1 — 10-41 Original11-1 — 11-12 Original12-1 — 12-40 Original13-1 — 13-11 Original14-1 — 14-9 Original15-1 — 15-36 Original16-1 — 16-13 Original17-1 — 17-6 Original18-1 — 18-19 Original19-1 — 19-11 Original20-1 — 20-26 OriginalIndex-1 — Index-12 OriginalRegistration Original
Trademarks
SIMATICr, SINECr, and STEPr are registered trademarks, and S5t and S7t are trademarks, of Siemens AG.
PCSt, APTt, Series 505t, and TISOFTt are trademarks of Siemens Energy & Automation, Inc.
Adober and Acrobatr are registered trademarks of Adobe Systems, Inc.
@aGlancet and Net OLEt are trademarks of Axeda, Inc.
Epsonr is a registered trademark of Seiko Epson Kabushiki Kaisha.
Excelt is a trademark, and Windowsr and MS-DOSr are registered trademarks, of Microsoft Corporation.
HPr, DeskJetr, LaserJetr, and PaintJetr are registered trademarks of Hewlett--Packard Company.
IBMr is a registered trademark of International Business Machines Corporation.
Intelr is a registered trademark of Intel Corporation.
Internetr is a registered trademark of Internet, Inc.
Lantronixr is a registered trademark of Lantronix.
Linuxr is a registered trademark of Linus Torvalds.
Lotusr and 1--2--3r are registered trademarks of Lotus Development Corporation.
Network Computing Devicesr is a registered trademark of Network Computing Devices, Inc.
Oracler is a registered trademark of Oracle Corporation.
PostScriptr is a registered trademark of Adobe Systems, Inc.
Red Hatr is a registered trademark of Red Hat, Inc.
TIt is a trademark of Texas Instruments, Inc.
Tektronixr is a registered trademark of Tektronix, Inc.
UNIXr is a registered trademark of X/Open Company, Ltd.
VMSr is a registered trademark of Compaq.
X Window Systemt is a trademark, and Motifr is a registered trademark, of the Open Group.
XESSr is a licensed, registered trademark, and AISr is a registered trademark of Applied Information Systems, Inc.
Other trademarks are the acknowledged property of their respective holders.
Contents iii
Contents
Preface xxiii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 1 The OSx Library of Blocks 1-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.1 Introduction to the OSx Library 1-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overview 1-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Installing the Engineering Toolset 1-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Reserving Memory for OSx Functions 1-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 List of Blocks 1-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Guidelines for Using the OSx Library 1-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Required Blocks 1-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Enabling/Disabling Blocks 1-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .SAMPLE_T 1-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Function Block I/O Labels 1-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Using Block Inputs and Outputs in SFCs 1-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Invisible I/O Elements 1-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Making I/O Elements Invisible 1-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Inverting I/O Elements 1-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Power-Fail Recovery 1-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4 Creating Tags from Function Blocks 1-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Marking Function Blocks 1-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Configuring Tag Parameters in the Comment Field 1-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Calculating the Hex Number for Process Groups 1-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Initial Values for Networked Attributes 1-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Configuring Initial Value in Block Object Properties 1-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Configuring Initial Value in WinCC Attributes 1-32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 2 I/O Control Blocks 2-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1 I/O Control Blocks 2-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Overview 2-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Analog I/O 2-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Digital I/O 2-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Word I/O 2-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 AI (Analog Input) 2-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 AO (Analog Output) 2-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iv Contents
2.4 RTD (Resistive Temperature Detector) 2-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.5 TC (Thermocouple) 2-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.6 DI (Digital Input) 2-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.7 DO (Digital Output) 2-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.8 WI (Word Input) 2-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.9 WO (Word Output) 2-32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.10 BI (BCD Input) 2-34. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.11 BO (BCD Output) 2-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 3 Standard Control Blocks 3-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1 Overview of Standard Control Blocks 3-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 PID (Proportional-Integral-Derivative) Loop 3-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Loop Control 3-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Required Blocks 3-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Loop Algorithm 3-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Standard PID Algorithm (Position Algorithm) 3-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Velocity Algorithm 3-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The PID Block 3-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .PID Inputs and Outputs 3-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Associated Math 3-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Loop Status 3-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3 ONOFF (On/Off) 3-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .On/Off Control 3-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Required Blocks 3-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The ONOFF Block 3-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ONOFF Inputs and Outputs 3-34. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Associated Math 3-37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4 ALRM (Analog Alarm) 3-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Overview 3-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Required Blocks 3-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The ALRM Block 3-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ALRM Inputs and Outputs 3-45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Associated Math 3-46. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents v
Chapter 4 Dynamic Control 4-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1 Understanding Dynamic Blocks 4-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 FOLAG (First Order Lag) 4-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3 FOLL (First Order Lead Lag) 4-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 SOLAG (Second Order Lag) 4-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5 SOLL (Second Order Lead Lag) 4-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6 DTD (Dead Time Delay) 4-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.7 DERV (Derivative) 4-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.8 INTEG (Integrator) 4-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 5 Advanced Control Blocks 5-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1 Understanding Advanced Control Blocks 5-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 DTC (Dead Time Compensator) 5-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 DMD (Dual Mode) 5-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4 FFOA (Feedforward Output Adjust) 5-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5 FFSA (Feedforward Setpoint Adjust) 5-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6 RATIO (Ratio Station) 5-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 6 Other Control Blocks 6-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.1 Understanding Other Control Blocks 6-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2 ARWPC (Anti-Reset Windup Protection/Constraint Type) 6-3. . . . . . . . . . . . . . . . . . . . . . . . . .
6.3 ARWPS (Anti-Reset Windup Protection/Select Type) 6-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4 CORLT (Correlated Lookup Table) 6-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 7 Understanding Devices 7-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1 Basic Operation of Devices 7-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Overview 7-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Device Types 7-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Controlling Devices from SFC 7-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vi Contents
7.2 Device Modes 7-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Manual Mode 7-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Auto Mode 7-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Changing Modes 7-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Changing States 7-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3 Device Feedback 7-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Override Inputs 7-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Reset Input 7-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Null Feedback 7-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Single Feedback 7-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Inverting Feedback Inputs 7-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Dual Feedback 7-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.4 User-defined Devices 7-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.5 Device Power-Fail Recovery 7-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 8 Valves 8-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.1 Valve Inputs and Outputs 8-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2 VND (Hand-Operated/Dual-Feedback Valve) 8-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.3 VSN (Single-Drive/Null-Feedback Valve) 8-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.4 VSS (Single-Drive/Single-Feedback Valve) 8-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.5 VSD (Single-Drive/Dual-Feedback Valve) 8-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.6 VDD (Dual-Drive/Dual-Feedback Valve) 8-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.7 VMD (Motor-Drive/Dual-Feedback Valve) 8-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.8 VUD (User-defined Valve) 8-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.9 BV1 (Three-Position Valve/Type 1) 8-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.10 BV2 (Three-Position Valve/Type 2) 8-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 9 Valve Control 9-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1 MPC (Motor Position Control) 9-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2 PTC (Proportional Time Control) 9-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3 SPL_RNG (Split Range) 9-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.4 VLV_SEQ (Valve Sequencer) 9-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents vii
Chapter 10 Motors 10-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1 Motor Inputs and Outputs 10-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2 MSN (Single-Drive/Null-Feedback Motor) 10-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.3 MSS (Single-Drive/Single-Feedback Motor) 10-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.4 MDN (Dual-Drive/Null-Feedback Motor) 10-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.5 MDS (Dual-Drive/Single-Feedback Motor) 10-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.6 MUD (User-defined Motor) 10-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.7 RM1 (Reversible Motor/Type 1) 10-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.8 RM2 (Reversible Motor/Type 2) 10-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.9 TS1 (Two-Speed Motor/Type 1) 10-32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.10 TS2 (Two-Speed Motor/Type 2) 10-37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 11 Cylinders 11-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.1 Cylinder Inputs and Outputs 11-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2 CSD (Single-Drive/Dual-Feedback Cylinder) 11-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3 CUD (User-defined Cylinder) 11-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 12 Presses 12-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.1 Press Inputs and Outputs 12-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.2 PND (Hand-Operated/Dual-Feedback Press) 12-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.3 PSN (Single-Drive/Null-Feedback Press) 12-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4 PSS (Single-Drive/Single-Feedback Press) 12-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.5 PSD (Single-Drive/Dual-Feedback Press) 12-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.6 PDD (Dual-Drive/Dual-Feedback Press) 12-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.7 PMD (Motor-Drive/Dual-Feedback Press) 12-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.8 PUD (User-defined Press) 12-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.9 PS1 (Three-Position Press/Type 1) 12-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.10 PS2 (Three-Position Press/Type 2) 12-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
viii Contents
Chapter 13 Counter and Timer 13-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.1 CT_DECL (Counter Declaration) 13-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2 TI_DECL (Timer Declaration) 13-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.3 TMR (Stopwatch Timer) 13-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 14 Basic Math Operations 14-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.1 Overview 14-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.2 ABS_MTH (Absolute Value) 14-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.3 DIV_MTH (Divider) 14-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.4 MLT_MTH (Multiplier) 14-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.5 SQR_MTH (Square) 14-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.6 SQRT_MTH (Square Root) 14-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.7 SUB_MTH (Subtractor) 14-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.8 SUM_MTH (Summer) 14-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 15 Math Functions 15-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.1 BCDBIN (BCD-to-Binary Conversion) 15-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2 BINBCD (Binary-to-BCD Conversion) 15-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.3 BIT_ASGN (Bit Assign) 15-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.4 BITCLEAR (Bit Clear) 15-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.5 BITSET (Bit Set) 15-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.6 BITTEST (Bit Test) 15-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.7 EDGE (Edge) 15-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.8 FRAC (Fraction) 15-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.9 LEAD_LAG (Lead Lag) 15-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.10 LEFT_SH (Left Shift) 15-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.11 LIMIT (Limit) 15-21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.12 MAX (Maximum Value) 15-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.13 MIN (Minimum Value) 15-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents ix
15.14 MINMAX (Minimum and Maximum Value) 15-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.15 RIGHT_SH (Right Shift) 15-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.16 ROUND (Round) 15-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.17 SCL_BLK (Scale) 15-33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.18 TRUNC (Truncate) 15-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 16 Instructions 16-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.1 Understanding SCL Instructions 16-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.2 BITS_INT (Bits to Integer) 16-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.3 INT_BITS (Integer to Bits) 16-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.4 INTERPOL (Interpolate) 16-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.5 LOAD_ARR (Load Real Array) 16-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.6 LOAD_IAR (Load Integer Array) 16-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.7 LOOKUP (Lookup Table) 16-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.8 PACKBITS (Pack Bits) 16-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.9 UNPKBIT (Unpack Bits) 16-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 17 Limiters 17-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.1 OUT_LIM (Output Limiter) 17-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2 RATE_LIM (Rate Limiter) 17-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 18 Selectors 18-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.1 Understanding Selector Blocks 18-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2 AVG_SEL (Average Selector) 18-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3 HIGH_SEL (High Selector) 18-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.4 ISWT_SEL (Inswitch Selector) 18-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.5 LOW_SEL (Low Selector) 18-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.6 MED_SEL (Median Selector) 18-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.7 OSWT_SEL (Outswitch Selector) 18-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.8 THR_SEL (Threshold Selector) 18-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
x Contents
Chapter 19 Arrays 19-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.1 SEQ_ARY (Sequence Array) 19-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.2 SR_ARY (Shift Register Array) 19-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3 TA (Text Array) 19-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 20 Elementary OSx Types 20-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.1 Understanding Elementary OSx Types 20-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.2 CALC (Calculated Value) 20-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3 IVAR (Integer Value) 20-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.4 SI (Scaled Integer) 20-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.5 FLAG (Flag) 20-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.6 DI10 (Digital Input Array of Size 10) 20-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.7 DO10 (Digital Output Array of Size 10) 20-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.8 TEXT (Text) 20-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.9 UNIT (Unit) 20-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.10 AREA (Area) 20-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Index Index-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents xi
List of Figures
1-1 OSx Library Function Blocks in CFC 1-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-2 Settings for Compiling Dialog Box 1-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-3 Making an I/O Element Invisible 1-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-4 Properties -- I/O Dialog Box 1-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-5 Inverted Input in CFC 1-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-6 Adding a Block to the Restart OB 1-21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-7 Block Object Properties 1-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-8 Operator Control and Monitoring Window 1-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-9 Hex Values for Process Groups 1-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-10 Setting Initial Value in the Block Object Properties I/O Folder 1-31. . . . . . . . . . . . . . . . . . . . . . . . . .1-11 Setting Initial Value in the WinCC Attributes Folder 1-33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2-1 Using the AI Block with External Scaling 2-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-2 AI Block 2-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-3 AO Block 2-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-4 Using the RTD Block with S7 I/O 2-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-5 RTD Block 2-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-6 Using the TC Block with S7 I/O 2-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-7 TC Block 2-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-8 DI Block 2-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-9 DO Block 2-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-10 WI Block 2-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-11 WO Block 2-32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-12 BI Block 2-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-13 BO Block 2-37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-1 Process Control Loop 3-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2 PID Block 3-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-3 Cascaded Loops 3-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-4 Process Variable Alarms 3-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-5 Setpoint Deviation Alarms 3-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6 PID Algorithms 3-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-7 ONOFF Block 3-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-8 ONOFF Example 3-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-9 Direct and Reverse-Acting ONOFF Block 3-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-10 ALRM Block 3-42. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-1 Forward and Backward Initialization 4-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-2 First Order Lag 4-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3 FOLAG Block 4-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4 First Order Lead Lag 4-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xii Contents
4-5 FOLL Block 4-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-6 Second Order Lag 4-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-7 SOLAG Block 4-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-8 Second Order Lead Lag 4-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-9 SOLL Block 4-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-10 Dead Time Delay Form 4-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-11 DTD Block 4-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-12 Derivative 4-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-13 DERV Block 4-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-14 Integrator 4-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-15 INTEG Block 4-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-1 Dead Time Compensator DTC 5-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-2 DTC Block 5-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-3 Dual Mode Operation 5-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-4 DMD Block 5-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-5 Fast Forward Output Adjustment 5-21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-6 FFOA Block 5-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-7 Feedforward Setpoint Adjust 5-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-8 FFSA Block 5-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-9 Ratio Station Graphic 5-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-10 RATIO Block 5-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-1 ARWPC Block 6-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-2 ARWPS Block 6-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-3 CORLT Block 6-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7-1 Connecting an OSx Device to Your Process 7-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-2 Controlling Devices from SFC 7-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-3 Manual and Auto Modes 7-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-4 Example Control Logic for User-defined Devices 7-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8-1 VND Block 8-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-2 VSN Block 8-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-3 VSS Block 8-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-4 VSD Block 8-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-5 VDD Block 8-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-6 VMD Block 8-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-7 VUD Block 8-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-8 BV1 Block 8-33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-9 BV2 Block 8-38. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents xiii
9-1 Using the MPC Block 9-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-2 MPC Block 9-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-3 PTC Block 9-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-4 Split Range Reverse and Normal Scaling 9-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-5 SPL_RNG Block 9-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-6 VLV_SEQ Block 9-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10-1 MSN Block 10-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-2 MSS Block 10-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-3 MDN Block 10-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-4 MDS Block 10-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-5 MUD Block 10-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-6 RM1 Block 10-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-7 RM2 Block 10-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-8 TS1 Block 10-34. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-9 TS2 Block 10-39. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11-1 CSD Block 11-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-2 CUD Block 11-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12-1 PND Block 12-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-2 PSN Block 12-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-3 PSS Block 12-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-4 PSD Block 12-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-5 PDD Block 12-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-6 PMD Block 12-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-7 PUD Block 12-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-8 PS1 Block 12-33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-9 PS2 Block 12-38. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13-1 CT_DECL Block 13-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-2 TI_DECL Block 13-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-3 TMR Block 13-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14-1 ABS_MTH Block 14-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-2 DIV_MTH Block 14-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-3 MLT_MTH Block 14-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-4 SQR_MTH Block 14-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-5 SQRT_MTH Block 14-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-6 SUB_MTH Block 14-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-7 SUM_MTH Block 14-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xiv Contents
15-1 BCDBIN Example 15-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-2 BCDBIN Block 15-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-3 BINBCD Example 15-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-4 BINBCD Block 15-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-5 BIT_ASGN Example 15-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-6 BIT_ASGN Function 15-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-7 BITCLEAR Example 15-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-8 BITCLEAR Function 15-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-9 BITSET Example 15-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-10 BITSET Function 15-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-11 BITTEST Example 15-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-12 BITTEST Function 15-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-13 EDGE Block 15-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-14 FRAC Function 15-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-15 LEAD_LAG Block 15-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-16 LEFT_SH Example 15-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-17 LEFT_SH Function 15-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-18 LIMIT Function 15-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-19 MAX Example 15-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-20 MAX Block 15-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-21 MIN Example 15-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-22 MIN Block 15-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-23 MINMAX Example 15-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-24 MINMAX Block 15-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-25 RIGHT_SH Example 15-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-26 RIGHT_SH Function 15-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-27 ROUND Function 15-32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-28 SCL_BLK Block 15-34. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-29 TRUNC Function 15-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16-1 BITS_INT Example 16-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16-2 INT_BITS Example 16-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16-3 INTERPOL Example 16-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16-4 LOAD_ARR Example 16-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16-5 LOAD_IAR Example 16-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16-6 LOOKUP Example 16-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16-7 PACKBITS Example 16-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16-8 UNPKBIT Example 16-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents xv
17-1 OUT_LIM Block 17-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17-2 RATE_LIM Block 17-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-1 Selecting an Average 18-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18-2 AVG_SEL Block 18-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18-3 HIGH_SEL Block 18-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18-4 ISWT_SEL Block 18-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18-5 LOW_SEL Block 18-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18-6 MED_SEL Block 18-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18-7 OSWT_SEL Block 18-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18-8 THR_SEL Block 18-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19-1 SEQ_ARY Block 19-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19-2 Shift Register Array Example 19-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19-3 SR_ARY Block 19-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19-4 TA Block 19-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20-1 CALC Block 20-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-2 IVAR Block 20-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-3 Using Scaled Integers in SFC Steps 20-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-4 SI Block 20-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-5 FLAG Block 20-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-6 DI10 Block 20-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-7 DO10 Block 20-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-8 TEXT Block 20-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-9 UNIT Block 20-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-10 Recipe Download Coordination 20-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-11 AREA Block 20-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xvi Contents
List of Tables
1-1 OSx Library of Blocks 1-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-2 OSx Tag Types and S7 Function Blocks 1-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-3 Required Blocks 1-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-4 Function Blocks with Power-Fail Recovery 1-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-5 Attributes with Upload as the Default 1-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-6 Non-networked Attributes 1-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-7 Examples of Process Group Assignment 1-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2-1 Scaling for the AI Block 2-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-2 Input Table for AI 2-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-3 Output Table for AI 2-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-4 Input Table for AO 2-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-5 Output Table for AO 2-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-6 Input Table for RTD 2-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-7 Output Table for RTD 2-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-8 Input Table for TC 2-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-9 Output Table for TC 2-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-10 Input Table for DI 2-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-11 Output Table for DI 2-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-12 Input Table for DO 2-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-13 Output Table for DO 2-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-14 Input Table for WI 2-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-15 Output Table for WI 2-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-16 Input Table for WO 2-33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-17 Output Table for WO 2-33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-18 Input Table for BI 2-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-19 Output Table for BI 2-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-20 Input Table for BO 2-37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-21 Output Table for BO 2-37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-1 Input Table for PID 3-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2 Output Table for PID 3-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-3 Input Table for ONOFF 3-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-4 Output Table for ONOFF 3-33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-5 Input Table for ALRM 3-44. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6 Output Table for ALRM 3-45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-1 Input Table for FOLAG 4-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-2 Output Table for FOLAG 4-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3 Input Table for FOLL 4-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4 Output Table for FOLL 4-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents xvii
4-5 Input Table for SOLAG 4-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-6 Output Table for SOLAG 4-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-7 Input Table for SOLL 4-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-8 Output Table for SOLL 4-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-9 Input Table for DTD 4-21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-10 Output Table for DTD 4-21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-11 Input Table for DERV 4-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-12 Output Table for DERV 4-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-13 Input Table for INTEG 4-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-14 Output Table for INTEG 4-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-1 Input Table for DTC 5-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-2 Output Table for DTC 5-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-3 Input Table for DMD 5-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-4 Output Table for DMD 5-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-5 Input Table for FFOA 5-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-6 Output Table for FFOA 5-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-7 Input Table for FFSA 5-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-8 Output Table for FFSA 5-33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-9 Input Table for RATIO 5-38. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-10 Output Table for RATIO 5-40. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-1 ARWPC Error Codes 6-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-2 Input Table for ARWPC 6-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-3 Output Table for ARWPC 6-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-4 ARWPS Error Codes 6-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-5 Input Table for ARWPS 6-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-6 Output Table for ARWPS 6-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-7 Input Table for CORLT 6-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-8 Output Table for CORLT 6-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7-1 OSx Library Devices 7-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-2 Controlling Devices in Auto Mode 7-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8-1 Valve Inputs 8-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-2 Valve Outputs 8-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-3 Input Table for VND 8-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-4 Output Table for VND 8-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-5 Input Table for VSN 8-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-6 Output Table for VSN 8-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-7 Input Table for VSS 8-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xviii Contents
8-8 Output Table for VSS 8-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-9 Input Table for VSD 8-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-10 Output Table for VSD 8-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-11 Input Table for VDD 8-21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-12 Output Table for VDD 8-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-13 Input Table for VMD 8-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-14 Output Table for VMD 8-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-15 Input Table for VUD 8-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-16 Output Table for VUD 8-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-17 Input Table for BV1 8-34. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-18 Output Table for BV1 8-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-19 Input Table for BV2 8-39. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-20 Output Table for BV2 8-40. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9-1 Input Table for MPC 9-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-2 Output Table for MPC 9-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-3 Input Table for PTC 9-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-4 Output Table for PTC 9-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-5 Input Table for SPL_RNG 9-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-6 Output Table for SPL_RNG 9-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-7 Input Table for VLV_SEQ 9-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-8 Output Table for VLV_SEQ 9-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10-1 Motor Inputs 10-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-2 Motor Outputs 10-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-3 Input Table for MSN 10-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-4 Output Table for MSN 10-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-5 Input Table for MSS 10-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-6 Output Table for MSS 10-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-7 Input Table for MDN 10-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-8 Output Table for MDN 10-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-9 Input Table for MDS 10-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-10 Output Table for MDS 10-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-11 Input Table for MUD 10-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-12 Output Table for MUD 10-21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-13 Input Table for RM1 10-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-14 Output Table for RM1 10-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-15 Input Table for RM2 10-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-16 Output Table for RM2 10-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-17 Input Table for TS1 10-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents xix
10-18 Output Table for TS1 10-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-19 Input Table for TS2 10-40. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-20 Output Table for TS2 10-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11-1 Cylinder Inputs 11-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-2 Cylinder Outputs 11-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-3 Input Table for CSD 11-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-4 Output Table for CSD 11-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-5 Input Table for CUD 11-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-6 Output Table for CUD 11-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12-1 Press Inputs 12-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-2 Press Outputs 12-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-3 Input Table for PND 12-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-4 Output Table for PND 12-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-5 Input Table for PSN 12-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-6 Output Table for PSN 12-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-7 Input Table for PSS 12-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-8 Output Table for PSS 12-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-9 Input Table for PSD 12-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-10 Output Table for PSD 12-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-11 Input Table for PDD 12-21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-12 Output Table for PDD 12-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-13 Input Table for PMD 12-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-14 Output Table for PMD 12-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-15 Input Table for PUD 12-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-16 Output Table for PUD 12-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-17 Input Table for PS1 12-34. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-18 Output Table for PS1 12-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-19 Input Table for PS2 12-39. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-20 Output Table for PS2 12-40. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13-1 Input Table for CT_DECL 13-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-2 Output Table for CT_DECL 13-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-3 Calculating SAMPLE_T 13-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-4 Input Table for TI_DECL 13-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-5 Output Table for TI_DECL 13-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-6 Calculating SAMPLE_T 13-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-7 Input Table for TMR 13-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-8 Output Table for TMR 13-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xx Contents
14-1 Input Table for ABS_MTH 14-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-2 Output Table for ABS_MTH 14-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-3 Input Table for DIV_MTH 14-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-4 Output Table for DIV_MTH 14-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-5 Input Table for MLT_MTH 14-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-6 Output Table for MLT_MTH 14-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-7 Input Table for SQR_MTH 14-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-8 Output Table for SQR_MTH 14-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-9 Input Table for SQRT_MTH 14-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-10 Output Table for SQRT_MTH 14-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-11 Input Table for SUB_MTH 14-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-12 Output Table for SUB_MTH 14-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-13 Input Table for SUM_MTH 14-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-14 Output Table for SUM_MTH 14-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-1 Input Table for BCDBIN 15-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-2 Output Table for BCDBIN 15-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-3 Input Table for BINBCD 15-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-4 Output Table for BINBCD 15-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-5 Input Table for BIT_ASGN 15-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-6 Output Table for BIT_ASGN 15-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-7 Input Table for BITCLEAR 15-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-8 Output Table for BITCLEAR 15-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-9 Input Table for BITSET 15-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-10 Output Table for BITSET 15-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-11 Input Table for BITTEST 15-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-12 Output Table for BITTEST 15-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-13 Input Table for EDGE 15-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-14 Output Table for EDGE 15-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-15 Input Table for FRAC 15-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-16 Output Table for FRAC 15-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-17 Input Table for LEAD_LAG 15-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-18 Output Table for LEAD_LAG 15-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-19 Input Table for LEFT_SH 15-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-20 Output Table for LEFT_SH 15-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-21 Input Table for LIMIT 15-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-22 Output Table for LIMIT 15-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-23 Input Table for MAX 15-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-24 Output Table for MAX 15-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-25 Input Table for MIN 15-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents xxi
15-26 Output Table for MIN 15-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-27 Input Table for MINMAX 15-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-28 Output Table for MINMAX 15-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-29 Input Table for RIGHT_SH 15-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-30 Output Table for RIGHT_SH 15-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-31 Input Table for ROUND 15-32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-32 Output Table for ROUND 15-32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-33 Input Table for SCL_BLK 15-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-34 Output Table for SCL_BLK 15-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-35 Input Table for TRUNC 15-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-36 Output Table for TRUNC 15-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17-1 Input Table for OUT_LIM 17-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17-2 Output Table for OUT_LIM 17-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17-3 Input Table for RATE_LIM 17-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17-4 Output Table for RATE_LIM 17-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-1 Input Table for AVG_SEL 18-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-2 Output Table for AVG_SEL 18-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-3 Input Table for HIGH_SEL 18-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18-4 Output Table for HIGH_SEL 18-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-5 Input Table for ISWT_SEL 18-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-6 Output Table for ISWT_SEL 18-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-7 Input Table for LOW_SEL 18-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-8 Output Table for LOW_SEL 18-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-9 Input Table for MED_SEL 18-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18-10 Output Table for MED_SEL 18-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-11 Input Table for OSWT_SEL 18-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-12 Output Table for OSWT_SEL 18-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-13 Input Table for THR_SEL 18-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-14 Output Table for THR_SEL 18-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19-1 Input Table for SEQ_ARY 19-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19-2 Output Table for SEQ_ARY 19-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19-3 Input Table for SR_ARY 19-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19-4 Output Table for SR_ARY 19-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19-5 TA Error Codes 19-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19-6 Input Table for TA 19-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19-7 Output Table for TA 19-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xxii Contents
20-1 Input Table for CALC 20-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-2 Output Table for CALC 20-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-3 Input Table for IVAR 20-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-4 Output Table for IVAR 20-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-5 Input Table for SI 20-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-6 Output Table for SI 20-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-7 Input Table for FLAG 20-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-8 Output Table for FLAG 20-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-9 Input Table for DI10 20-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-10 Output Table for DI10 20-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-11 Input Table for DO10 20-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-12 Output Table for DO10 20-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-13 Input Table for TEXT 20-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-14 Output Table for TEXT 20-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-15 Batch Unit Tag I/O 20-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-16 Input Table for UNIT 20-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-17 Output Table for UNIT 20-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-18 Input Table for AREA 20-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20-19 Output Table for AREA 20-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Preface xxiiiSIMATIC PCS 7 OSx 4.1.2 Library
Preface
SIMATIC PCS 7 OSx Release 4.1.2 supports the following new features:
• OSx Merge Utility— This utility allows you to merge theconfiguration from one OSx system (or a subset of that system) intoanother, currently running OSx system. This means that you can domajor configuration development outside of an OSx system that isrunning a process, and then add it in without shutting down theprocess.
• Remote computer data archiving — Data archives can be storedon a remote computer. This can be any computer system that cansupport an FTP server; for example, UNIX, Linux, Windows NT,Windows 2000.
• Permanent select list— This feature allows you to choose whetherthe select list for tag details, graphics, reports, and so on (accessed fromthe Directory button) remains on the screen until you dismiss it, ordisappears when you select an entry.
• Graphic/tag cross reference report — A standard reportcross-referencing tags in graphics, by tag and by graphic, is available.
• Internet Protocol netmask configuration— You are prompted tospecify the netmask value or select a default at installation.
• Save new tag install file to hard disk— The feature allows savinga tag file to hard disk in addition to MO disk and diskette.
• SIMATIC Rack PC 840 support— The Rack PC 840 will now besupported as a system unit.
• 1.3 gigabyte and 640 megabyte MO disk support— DataArchiving and Backup/Restore will support larger MO disks with theRack PC 840 hardware platform. Earlier 230 and 540 megabyte MOdisks are still supported as well.
• Additional printer support— New printers in the Hewlett-PackardDeskJet line are supported.
New Features ofPCS 7 OSx
Prefacexxiv SIMATIC PCS 7 OSx 4.1.2 Library
The procedures in the various manuals give you step-by-step instructionsabout how to carry out tasks. Typically, the last step of any procedurerequires that you select the OK or Save button, or press Enter. To save spaceand avoid redundancy, this last step does not appear in the procedure.However, you need to finish each procedure with one of these actions.
OK Saves information that you have entered and closes the window.
Save Saves information that you have entered and does not close thewindow.
Cancel Closes the window without saving any information that youentered and terminates any action that you initiated.
Dismiss Closes the window. If you have already pressed Enter, your workis not lost; if you have not pressed Enter, your work is discarded.
The signpost indicates that the procedure that you are currently followingcontinues on the indicated page.
The different fonts used in the manual set have the following meanings.
• Entries that you type from the keyboard are indicated with thecourier font.
• Items that you select on the screen, or keys that you press on thekeyboard, are indicated with this bolded font.
Items that you select on a cascaded menu are linked in the manual textwith arrows. The first term indicates where to click the main menu bar. Forexample, Controls-->Change System State tells you to click Controls on themain menu bar, then select Change System State from the pull-down menu.
Change System State
Shutdown OSx and Linux
Shutdown OSxOfflineOperate
CancelOK
Change System StateControls Startup
LogoffLogonOSx Terminal
Conventions Usedin the Manual Set
Continue onPage 3-26.
Preface xxvSIMATIC PCS 7 OSx 4.1.2 Library
The SIMATIC PCS 7 OSx Library Manual is intended primarily as areference manual, describing the OSx Library function blocks that allow youto program S7-400 controllers to interface with the SIMATIC PCS 7 OSxsystem.
• Chapter 1 gives an overview of the OSx Library, lists the availablefunction blocks, and suggests guidelines for using the library. Inaddition, it explains how to create OSx tags from the function blocks.
• Chapter 2 describes the I/O control blocks and how to configure them.
• Chapter 3 describes the standard PID, on/off, and alarm functionblocks and how to configure them.
• Chapter 4 describes the dynamic control blocks.
• Chapter 5 describes the advanced control blocks.
• Chapter 6 describes the other control blocks for anti--reset windup andcorrelated lookup table.
• Chapter 7 describes general guidelines for using device function blocks,such as valves, motor, presses, and cylinders.
• Chapter 8 describes valves.
• Chapter 9 describes various blocks used for valve control.
• Chapter 10 describes motors.
• Chapter 11 describes cylinders.
• Chapter 12 describes presses.
• Chapter 13 describes counters and timers.
• Chapter 14 describes basic math operations, such as adding, dividing,and squaring.
• Chapter 15 describes math instructions such as data type conversion,bit set, shift, edge, min/max, scaling, and rounding operations.
• Chapter 16 describes SCL instructions, such as bits-to-integer, loadarray, and interpolate functions.
Purpose of ThisManual
Prefacexxvi SIMATIC PCS 7 OSx 4.1.2 Library
• Chapter 17 describes output and rate limiters.
• Chapter 18 describes blocks that select a value, such as high, low, oraverage, from a number of inputs.
• Chapter 19 describes sequence array, shift register array, and textarray blocks.
• Chapter 20 describes OSx-type blocks, such as DI10, DO10, CALC, andUNIT.
• The Master Index is a subject reference to all standard PCS 7 OSxsoftware manuals.
The PCS 7 OSx manual set consists of several manuals. If you cannot findth e i n f o r m atio n th at y o u n e e d in th e SI MAT I C PCS 7 O Sx Li br a r y Ma n u a l ,check these other books:
• SIMATIC PCS 7 OSx System Administration Manual This manualoffers help in configuring network nodes, and for procedures thatdescribe how to configure printers, how to archive data, and how toback up files.
• SIMATIC PCS 7 OSx Process Configuration Manual This manualdescribes the primary tasks required to configure your OSx station forcontrolling your process.
• SIMATIC PCS 7 OSx Graphical Editor Manual This manualdescribes how to create the graphical displays used with PCS 7.
• SIMATIC PCS 7 OSx Hardware Manual This manual describes thevarious hardware components of the system and how to install them.
• SIMATIC PCS 7 OSx Reports Manual This manual describes how tocreate reports on your process and your PCS 7 configuration.
• SIMATIC PCS 7 OSx Recipe Manual This manual describes advancedconfiguration tasks involving the creation and use of recipes.
• SIMATIC PCS 7 OSx Batch Programming Manual This manualdescribes advanced configuration tasks involving the use of BCL, theBatch Control Language, and the creation of batch programs.
• SIMATIC PCS 7 OSx Operator Manual This manual describes how tocarry out the various tasks that the process operator must do when thesystem is in the Operate state. You may photocopy all or portions ofthis manual as a reference for your operators.
The Other Manuals
Preface xxviiSIMATIC PCS 7 OSx 4.1.2 Library
• SIMATIC PCS 7 OSx Interface to S5 Controllers Manual This manualdescribes the OSx interface with SIMATIC S5 controllers.
• SIMATIC PCS 7 OSx Interface to S7 Controllers Manual This manualdescribes the OSx interface with SIMATIC S7 controllers.
Be sure to check the Readme File for information that did not becomeavailable until after the publication deadlines for the OSx manuals. TheReadme File also points to important copyright, licensing, and warrantyinformation. Select Help-->About OSx from the main menu bar, and then clickthe Show Readme button at the bottom of the About OSx dialog box.
The following manuals are available for optional PCS 7 OSx features.
• SIMATIC PCS 7 OSx Remote Data Transfer Manual This manualdescribes the remote data transfer feature, which allows you totransmit data collected from the process by an OSx station to an Oracledatabase on the remote computer for historical records and otherpurposes.
• SIMATIC PCS 7 OSx X Terminal User Manual This manual describeshow to connect and operate an X terminal as an extension of an OSxstation.
• SIMATIC PCS 7 OSx @aGlance User Manual This manual describeshow to import OSx data into a Windows application, such as Excel orLotus 1-2-3, or into another UNIX or VMS application.
If you have difficulty with your system, contact the Siemens Energy &Automation, Inc., Technical Services Group in the U.S.A. at 800--333--7421.Outside the U.S.A., call 49--911--895--7000.
Optional PCS 7OSx Features
If You Need Help
Prefacexxviii SIMATIC PCS 7 OSx 4.1.2 Library
1-1SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Chapter 1
The OSx Library of Blocks
1.1 Introduction to the OSx Library 1-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overview 1-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Installing the Engineering Toolset 1-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Reserving Memory for OSx Functions 1-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 List of Blocks 1-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Guidelines for Using the OSx Library 1-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Required Blocks 1-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Enabling/Disabling Blocks 1-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .SAMPLE_T 1-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Function Block I/O Labels 1-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Using Block Inputs and Outputs in SFCs 1-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Invisible I/O Elements 1-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Making I/O Elements Invisible 1-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Inverting I/O Elements 1-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Power-Fail Recovery 1-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4 Creating Tags from Function Blocks 1-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Marking Function Blocks 1-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Configuring Tag Parameters in the Comment Field 1-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Calculating the Hex Number for Process Groups 1-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Initial Values for Networked Attributes 1-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Configuring Initial Value in Block Object Properties 1-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Configuring Initial Value in WinCC Attributes 1-32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-2 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
1.1 Introduction to the OSx Library
The OSx Library is an add-on library to be used with the SIMATIC PCS 7Engineering Toolset. The Engineering Toolset, in conjunction with the OSxLibrary, allows you to program S7-400 controllers to interface with theSIMATIC PCS 7 OSx system.
The function blocks in the OSx Library have been designed for compatibilitybetween the S7 environment and the OSx system. They provide a tagstructure compatible with the OSx database. Specifically, the functionblocks in the OSx Library support the alarm capability of the OSx database.In addition, these function blocks are fully compatible with the standardOSx graphical objects.
The function blocks in the OSx Library are designed with the fullfunctionality provided by the blocks found in APT; however, theconfiguration tools are different. Refer to the section in this manual for eachfunction block for proper configuration.
To use the function blocks, you place them in CFCs (Figure 1-1). For certainfunction blocks to work properly, other blocks must be present in the Blocksfolder of the S7 program. These blocks are listed as required blocks in thesection for each function block. No configuration is needed for theserequired blocks.
Chapter 16 contains math instructions that can be used in SCLprogramming. There are no function blocks for these instructions. Somemath function blocks can also be used as instructions in SCL.
Overview
1-3SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
File Edit Insert PLC Debug View Options Window Help
SIMATIC Manager -- ST_LITE
ST_LITE--<Plan t Hierarchy, Offline>[Project]--D:\siemens\STEP7\S7P... ST_LITE--<Plan t Hierarchy, Offline>[Project]--D:\siemens\STEP7..
ST_LITE
Unit1
Plant
Unit2Unit3Unit4Unit5Unit6Unit7Unit8Unit9Unit10
Chart Edit Insert PLC Debug View Options Window Help
CFC--[ST_LITE\Plant\Unit1\FLAV_SYS]
Closes the CFC Editor Sheet 3 OB35 MIXER_DOs.Tdo_126
ALRM <
ABS_MTHALRMAOAREAAVG_SELBCDBINBINBCDBIT_ASGNBITCLEARBITSETBITS_INTBITTESTBV1BV2CALCCSDCT_DECLCUDDIDI10DIV_MTHDODO10EDGEFRAC
Plant Hierarchy Function Block OSx Library
OSx Library
CFC
Figure 1-1 OSx Library Function Blocks in CFC
1-4 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
Introduction to the OSx Library (continued)
Before you can begin development of your S7 program for OSx connection,you must install the Engineering Toolset from the CD-ROM labeled ProcessControl System PCS 7 Toolset. Check to see whether you are using thecorrect version of the Toolset, SIMATIC PCS 7 Version 5.01 (V5.0 + SP1) orlate r, and f ollow the appropriate p rocedure in Chapte r 1 of th e SI MAT I CPCS 7 OSx Interface to S7 Controllers Ma nual.
Function block numbers in the OSx library range from FB340 to FB407;functions range from FC900 to FC929. The default range for functions inCFCs does not cover the OSx functions. To ensure proper operation of theCFC with the OSx functions, you must reset the default for FC numbers.Follow the steps below:
1. Open any CFC in an S7 program.
2. Select Options-->Compilation Settings from the menu bar. The Settingsfor Compiling dialog box appears.
3. Under the heading Areas Disabled for CFC, change the higher of theFC numbers to 930 or greater (Figure 1-2).
4. Select OK. The appropriate memory locations are now reserved for theOSx library functions.
The new default setting applies to the CFCs in all of your S7 programs. Youdo not have to reset it separately for each CFC.
In an S7-417 controller, the total number of data blocks (DBs) available is8191. In an S7-416 controller, the total number of data blocks (DBs)available is 4095; in an S7-414 controller, the number is 1023. If you createa data block, make sure that the range of disabled DB numbers in thisdialog box includes the number of the data block. For example, if you createa data block DB12, the DB Numbers field must read 1 to at least 12.
Installing theEngineeringToolset
Reserving Memoryfor OSx Functions
1-5SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Settings for Compiling
HelpOK
Statistics
Areas disabled for CFC
Cancel
PLC CP416-2DP
DB numbers:
FC numbers: 60
to
to
Apply Compress
1 9
930
DB Number
FC Number
Maximum Available Occupied
4095
2048
4065
1107
430
82
Change the valuein this box to 930 orgreater.
Figure 1-2 Settings for Compiling Dialog Box
1-6 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
1.2 List of Blocks
Table 1-1 shows an alphabetical listing of all the function blocks andfunctions in the OSx Library of the Engineering Toolset, as well as themanual section that describes each block and the OSx tag type that theblock corresponds to, if applicable.
Table 1-1 OSx Library of Blocks
Name Description BlockNumber Section OSx Tag
Type
ABS_MTH Absolute value FC900 14.2 ------
AI Analog Input FB440 2.2 calc
ALRM Analog alarm FB384 3.4 ai
AO Analog output FB406 2.3 ao
AREA Area FB404 20.10 area
ARWPC Anti--reset windup protection / constrainttype FB427 6.2 do
ARWPS Anti--reset windup protection / select type FB428 6.3 do
AVG_SEL Average selector FB375 18.2 ------
BCDBIN BCD to binary conversion FB409 15.1 ------
BINBCD Binary to BCD conversion FB410 15.2 ------
BI BCD Input FB432 2.10 ivar
BIT_ASGN Bit assign FC912 15.3 ------
BITCLEAR Bit clear FC913 15.4 ------
BITSET Bit set FC914 15.5 ------
BITS_INT Bits to integer FC915 16.2 ------
BITTEST Bit test FC916 15.6 ------
BO BCD Output FB433 2.11 ivar
BV1 Three-position valve/type 1 FB351 8.9 mtr2
BV2 Three-position valve/type 2 FB352 8.10 mtr2
CALC Calculated value FB402 20.2 calc
CORLT Correlated Lookup Table FB439 6.4 do
CSD Single-drive/dual-feedback cylinder FB371 11.2 vlv2
CT_DECL Counter FB340 13.1 ctr
Table continues on next page.
1-7SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Table 1-1 OSx Library of Blocks (continued)
Name Description BlockNumber Section OSx Tag
Type
CUD User-defined cylinder FB372 11.3 vlv2
DERV Derivative FB421 4.7 do
DI Digital input FB398 2.6 di
DI10 Digital input array of size 10 FB400 20.6 di10
DIV_MTH Divider FC901 14.3 ------
DMD Dual Mode FB414 5.3 loop
DO Digital output FB399 2.7 do
DO10 Digital output array of size 10 FB401 20.7 do10
DTC Dead Time Compensator FB413 5.2 loop
DTD Dead Time Delay FB420 4.6 do
EDGE Edge FB388 15.7 ------
FFOA Feedforward Output Adjust FB415 5.4 loop
FFSA Feedforward Setpoint Adjust FB416 5.5 loop
FLAG Flag FB436 20.5 di
FOLAG First Order Lag FB423 4.2 do
FOLL First Order Lead Lag FB424 4.3 do
FRAC Fraction FC917 15.8 ------
HIGH_SEL High selector FB376 18.3 ------
INT_BITS Integer to bits FC919 16.3 ------
INTEG Integrator FB422 4.8 do
INTERPOL Interpolate FC918 16.4 ------
ISWT_SEL Inswitch selector FB377 18.4 ------
IVAR Integer variable FB403 20.3 ivar
LEAD_LAG Lead lag FB389 15.9 ------
LEFT_SH Left shift FC920 15.10 ------
LIMIT Limiter FC921 15.11 ------
LOAD_ARR Load real array FC922 16.5 ------
Table continues on next page.
1-8 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
List of Blocks (continued)
Table 1-1 OSx Library of Blocks (continued)
Name Description BlockNumber Section OSx Tag
Type
LOAD_IAR Load integer array FC931 16.6 ------
LOOKUP Lookup table FC923 16.7 ------
LOW_SEL Low selector FB378 18.5 ------
MAX Maximum value FB390 15.12 ------
MDN Dual-drive/null-feedback motor FB364 10.4 mtr1
MDS Dual-drive/single-feedback motor FB365 10.5 mtr1
MED_SEL Median selector FB379 18.6 ------
MIN Minimum value FB391 15.13 ------
MINMAX Minimum and maximum value FB392 15.14 ------
MLT_MTH Multiplier FC902 14.4 ------
MPC Motor Position Control FB418 9.1 do
MSN Single-drive/null-feedback motor FB362 10.2 mtr1
MSS Single-drive/single-feedback motor FB363 10.3 mtr1
MUD User-defined motor FB370 10.6 mtr1
ONOFF On/off FB383 3.3 loop
OSWT_SEL Outswitch selector FB380 18.7 ------
OUT_LIM Output limiter FB373 17.1 ------
PACKBITS Pack bits FC924 16.8 ------
PDD Dual-drive/dual-feedback press FB357 12.6 vlv2
PID Proportional-integral-derivative loop FB382 3.2 loop
PMD Motor-drive/dual-feedback press FB358 12.7 vlv2
PND Hand-operated/dual-feedback press FB355 12.2 vlv2
PS1 Three-position press/type 1 FB360 12.9 mtr2
PS2 Three-position press/type 2 FB361 12.10 mtr2
PSD Single-drive/dual-feedback press FB354 12.5 vlv2
PSN Single-drive/null-feedback press FB356 12.3 vlv1
PSS Single-drive/single-feedback press FB353 12.4 vlv1
Table continues on next page.
1-9SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Table 1-1 OSx Library of Blocks (continued)
Name Description BlockNumber Section OSx Tag
Type
PTC Proportional time control FB385 9.2 ------
PUD User-defined press FB359 12.8 vlv2
RATE_LIM Rate limiter FB374 17.2 ------
RATIO Ratio FB417 5.6 loop
RIGHT_SH Right shift FC928 15.15 ------
RM1 Reversible motor/type 1 FB366 10.7 rmtr
RM2 Reversible motor/type 2 FB367 10.8 rmtr
ROUND Round FC926 15.16 ------
RTD Resistive Temperature Detector FB434 2.4 calc
SCL_BLK Scale FB387 15.17 ------
SEQ_ARY Sequence array FB342 19.1 ------
SI Scaled Integer FB411 20.4 ao
SOLAG Second Order Lag FB425 4.4 do
SOLL Second Order Lead Lag FB426 4.5 do
SPL_RNG Split range FB386 9.3 ------
SQR_MTH Square FC904 14.5 ------
SQRT_MTH Square root FC905 14.6 ------
SR_ARY Shift register array FB343 19.2 ------
SUB_MTH Subtractor FC906 14.7 ------
SUM_MATH Summer FC907 14.8 ------
TA Text Array FB412 19.3 ------
TC Thermocouple FB435 2.5 calc
TEXT Text FB407 20.8 text
THR_SEL Threshold selector FB381 18.8 ------
TI_DECL Timer declaration FB341 13.2 ivar
TMR Stopwatch Timer FB429 13.3 ivar
TRUNC Truncate FC927 15.18 ------
Table continues on next page.
1-10 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
List of Blocks (continued)
Table 1-1 OSx Library of Blocks (continued)
Name Description BlockNumber Section OSx Tag
Type
TS1 Two-speed motor/type 1 FB368 10.9 mtr2
TS2 Two-speed motor/type 2 FB369 10.10 mtr2
UNIT Unit FB405 20.9 unit
UNPKBIT Unpack bits FC929 16.9 ------
VDD Dual-drive/dual-feedback valve FB348 8.6 vlv2
VLV_SEQ Valve Sequence Control FB419 9.4 do
VMD Motor-drive/dual-feedback valve FB349 8.7 vlv2
VND Hand-operated/dual-feedback valve FB346 8.2 vlv2
VSD Single-drive/dual-feedback valve FB345 8.5 vlv2
VSN Single-drive/null-feedback valve FB347 8.3 vlv1
VSS Single-drive/single-feedback valve FB344 8.4 vlv1
VUD User-defined valve FB350 8.8 vlv2
WI Word Input FB430 2.8 ivar
WO Word Output FB431 2.9 ao
1-11SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Table 1-2 lists the S7 function blocks that map to each OSx tag type.
Table 1-2 OSx Tag Types and S7 Function Blocks
OSx TagType S7 Function Blocks
ai ALRM
ao AO, WO, SI
area AREA
calc CALC, RTD, TC, AI
ctr CT_DECL
di DI, FLAG
di10 DI10
do DO, ARWPC, ARWPS, CORLT, DERV, DTD, FOLAG, FOLL,INTEG, MPC, SOLAG, SOLL, VLV_SEQ
do10 DO10
ivar BI, BO, IVAR, WI
loop DTC, DMD, FFOA, FFSA, LOOP, ONOFF, RATIO
mtr1 MDN, MDS, MSN, MSS, MUD
mtr2 BV1, BV2, PS1, PS2, TS1, TS2
rmtr RM1, RM2
text TEXT
tmr TI_DECL
unit UNIT
vlv1 PND, PSN, PSS, VND, VSN
vlv2 CSD, CUD, PDD, PMD, PSD, PUD, VDD, VMD, VSD, VSS, VUD
The ENABL input for the following function blocks is translated by OSx as aDO tag type; MPC, VLV_SEQ, DTD, DERV, INTEG,FOLAG, FOLL,SOLAG, SOLL, ARWPC, ARWPS, and CORLT. This is the only input oroutput of the function block other than status that is translated as a tag byOSx. The CUR output for the TMR function block is translated by OSx as anIVAR tag type.
1-12 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
1.3 Guidelines for Using the OSx Library
When you place a function block in a CFC, certain other blocks may need tobe present in the Blocks folder of your S7 program. If so, these other blocksare listed under the heading “Required Blocks” in the section of the manualfor that function block.
No user configuration is needed for the required blocks; they simply need tobe present in the S7 program for the other blocks to interface correctly withOSx. Table 1-3 lists the required blocks and briefly explains their purpose.
Table 1-3 Required Blocks
RequiredBlock
BlockNumber Description
PACKSTAT FC930 Blocks that generate exceptions to OSx use PACKSTAT to pack all the statusoutputs of an object into an integer for efficient transfer to OSx.
ADAPTER FB393 ADAPTER is an intermediate function used to call associated math blocks fromALARM, ONOFF, and PID.
RBE_S FB395RBE_S acts as an alarm interface between an OSx Library object and the OSxstation. RBE_S uses ALARM_S to detect and generate exceptions to OSx andhandles alarm acknowledgement and suppression for OSx Library objects.
RBE_P FB394RBE_P acts as an alarm interface between an OSx Library object and the OSxstation. RBE_P uses ALARM_8P to detect and generate exceptions to OSx andhandles alarm acknowledgement and suppression for OSx Library objects.
ALARM_S SFC18 RBE_S uses this function to send an ALARM_S type of message to OSx.
ALARM_8P SFB35 RBE_P uses this function to send an ALARM_8P type of message to OSx.
RD_SINFO SFC6RD_SINFO contains ReadStart information. Objects use this function to detectpower failure. Refer to online help or the SIMATIC STEP 7 Standard and SystemFunctions Manual for more information.
For function blocks that have REN, RDIS, ENABL, and DISABL inputs, theinputs function in the following way:
• REN sets ENABL to 1
• RDIS sets DISABL to 1 and ENABL to 0
Many function blocks have a NRDY (not ready) input. This input is providedfor device interlocking. When it is set, the object enters its de-energized orsafe state. NRDY is often used to interlock such devices as pumps andmotors. For devices that have an FTO (fail-to-open) output, the FTO outputcan be connected to the NRDY input of a motor. With such interlocking, themotor is shut down whenever the valve fails. This adds a level of protectionfor equipment and personnel.
Required Blocks
Enabling/DisablingBlocks
1-13SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Some function blocks have an input called SAMPLE_T that represents thetarget sample time for the function block. The value of SAMPLE_T is used tocontrol the timing for the execution of the block logic. When the block iscalled from an OB, the value of SAMPLE_T is added to an internal counter.When the value of the internal counter equals the execution time (forexample, ALRM_ST for the ALRM block, or UNIT_T for the RATE_LIM block),the block is processed.
Blocks that have the SAMPLE_T input are PID, ALRM, ONOFF, AI, RTD,TC, FOLAG, FOLL, SOLAG, SOLL, DTD, DERV, INTEG, DTC, DMD,FFOA, FFSA, RATIO, TI_DECL, LEAD_LAG, RATE_LIM, PTC, and alldevices except VND and PND.
By default, all function blocks in the OSx Library are attached to OB35,which means they are called every 100 ms. The default value for SAMPLE_Tis therefore set to 0.1 to assure correct timing.
If you choose to connect the block to another OB with a different interruptrate, you must also update SAMPLE_T. For example, connecting it to OB32(1000 ms) requires a value of 1.0 in SAMPLE_T.
If your process does not require high speed monitoring, you may want toconsider moving some of your blocks to OBs with longer interrupt times. Ifmore blocks are connected to OB35 than can be processed in 100 ms, thecontroller enters STOP mode.
Labels for inputs and outputs on the function blocks display only the firsteight characters of the element name. For the full name, refer to the inputand output tables that follow the function block figure.
The inputs and outputs of the OSx Library blocks in a CFC can also be usedin SFC steps and transitions. A small box above an input or output of thefunction block in a CFC indicates that an SFC transition has read access toit; a small box below an input or output of the function block indicates thatan SFC step has write access to it. The input or output is accessed by meansof the CFC_name.FB_name.ext. For example, for a VSN function blocknamed vlv_1, located on a CFC named FLAV_SYS, an SFC transition can useFLAV_SYS.vlv_1.opnd to check the state of the valve.
SAMPLE_T
Function Block I/OLabels
Using Block Inputsand Outputs inSFCs
1-14 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
Guidelines for Using the OSx Library (continued)
Certain I/O inputs (for example, inputs such as EV_ID, AND_MASK, or TPFAILin Figure 1-3) do not appear on the function block that you place in a CFC.These inputs work to facilitate the interface with OSx and are already set tothe required value.
You can view these inputs by double-clicking on the title bar of the functionblock in the CFC and selecting the I/Os tab in the Block Object Propertiesdialog box. Scroll to the right to locate the Not Displayed column. Theinputs that are checked in this column are “invisible”; that is, they are notdisplayed on the function block in the CFC. However, they are crucial to theproper functioning of the block and must not be altered in any way.
If you do not use all of the I/O elements in a function block, or if you alwaysuse certain elements the same way, you can set them to the appropriatevalue and then make them invisible. The elements are still present andfunctioning in the block, but they are not visible in the CFC, giving thefunction block a less cluttered appearance.
To make an I/O element invisible, follow these steps:
1. Double-click on the title bar of the function block in the CFC. The BlockObject Properties dialog box appears.
2. Click on the I/Os tab of the Block Object Properties dialog box.
3. Scroll right to locate the Not Displayed column, then click in the cell forthe element that you want to make invisible. A check appears in thecell, indicating that the element is now invisible (Figure 1-3). (To undo,simply click again.)
4. Click OK, and exit the Block Object Properties dialog box. The functionblock reformats itself to display only the visible elements. All elements,visible and invisible, are still present and functioning in the block.
For more complete details, refer to the online help for CFCs or to theSIMATIC S7 Programming Continuous Function Charts Manual.
Invisible I/OElements
Making I/OElements Invisible
1-15SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Block Object Properties:FLAV_SYS.Tvlv1_0
Cancel HelpOK
General Run-Time Properties I/Os
Name Value Comment
ENEV_IDAND_MASKOR_MASKSTATUSHEALTHTIMEOUT_1TIMEOUT_2MODE_CMDSETPOINTTPFAILRTLRTU
RTCMOPENDSBLD
1
16#000016#000016#000016#00000.00.016#00000000
000
00.11.01.01
16#00009C51 identify number for messageOSx AND maskOSx OR maskPacked STATUS bitsHealth of alarm systemMaps to O_ALRM_T
Packed command bitsMaps to .MOPENTest powerfail bit
Open valveClose valveManual openForced to manual mode
Not Displayed
Maps to C_ALRM_T
Place valve in auto modePlace valve in manual mode
RTO
LOCKDNRDYSAMPLE_TO_ALRM_TC_ALRM_TE_STATE
0
Not readyAuto mode
Sample time (s)Open alarm timeClose alarm timeEnergize state: 1--’open’, 0--’close’
Click here to makeE_STATE invisible.
Figure 1-3 Making an I/O Element Invisible
1-16 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
Guidelines for Using the OSx Library (continued)
You can invert a boolean input element. This means that 0 becomes 1, and 1becomes 0. For example, you can invert a normally-closed feedback input tonormally-open. The input must be interconnected before you can invert it.
However, you cannot invert an IN_OUT element. Attempting to invert anIN_OUT element may cause the program to execute incorrectly. Todetermine whether an input is IN or IN_OUT, double-click the title bar ofthe function block to access the Block Object Properties dialog box. Click theI/Os tab. The I/O type IN or IN_OUT is specified in the I/O column next tothe input name. Only interconnected boolean IN inputs can be inverted.
! WARNINGIf you invert an IN_OUT element, your program may fail to execute correctly.
Failure of a program to execute correctly can cause unpredictable controlleroperation, which can result in death or serious injury to personnel, and/ordamage to equipment.
Do not invert an IN_OUT element. Only IN inputs can be safely inverted.
To invert an input, follow the steps below:
1. Make sure that the input that you want to invert is an interconnectedboolean, input-only (IN) element. You can check its properties in theI/Os folder of the Block Object Properties dialog box.
Properties -- I/O
Help
Import/Export Assistant
IEA parameter
IEA interconnection
Block:I/O:
VSS.1IN(BOOL) OCLS
Value:
Text 0:
Text 1:
Comment: Feedback input (open/close)
Inverted
Not displayed
Watched
CancelOK
Figure 1-4 Properties -- I/O Dialog Box
Inverting I/OElements
1-17SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
2. Double-click on the input on the function block in the CFC. TheProperties -- I/O dialog box appears (Figure 1-4).
3. Click in the white square to the left of the Inverted field. A check markappears in the square.
4. Click OK. The input is now inverted and marked with a small bubblebeside the element in the function block (Figure 1-5).
OB355
BO EN
V14VSS
ENO BO1
Single-Drive/S
BO IGN_OVRD
R SAMPLE_T
BO OCLS
BO DSBLD
BO NRDY
BO RTLBO RTUBO RTO
BO RTCBO RESET
R C_ALRM_T
R O_ALRM_T
BO LOCKD
BO MOPEN
BO OVRDBO E_STATE
CMMD BOOPND BOCLSD BOTRVL BOFTO BOFTC BO
O_CUR_T R
00
0000
00.11.01.0
10
0
0
0
0
BO CLR_CMMD
“di1” m1.0
C_CUR_T R
Figure 1-5 Inverted Input in CFC
1-18 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
Guidelines for Using the OSx Library (continued)
Upon return from a power failure, the S7 controller executes one of thefolowing restart organization blocks (OBs):
• OB100 -- Warm restart
• OB101 -- Hot restart (not available on 417H)
• OB102 -- Cold restart
• OB105 -- Standby startup (417H only)
By default, certain OSx Library blocks have OB100 added to their task listsso that they are called on restart as well as from the user-specified cyclicOB. Function blocks that have power-fail recovery capability are listed inTable 1-4.
The block detects when it has been called from a start-up OB and thendetermines if the last controller state was power failure or program mode. Ifthe previous controller state was power failure, then the block goes to itsde-energized state.
Power-FailRecovery
1-19SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Table 1-4 Function Blocks with Power-Fail Recovery
Block Type Blocks with OB100 in the Task List
Advanced DMD, DTC, FFOA, FFSA, RATIO
Array SR_ARY
Counter/Timer TMR
Cylinder CSD
Elementary FLAG
Limiter OUT_LIM, RATE_LIM
Math SCL_BLK
Motor MDN, MDS, MSN, MSS, RM1, RM2, TS1, TS2
Press PDD, PMD, PS1, PS2, PSD, PSN, PSS
Selector AVG_SEL, HIGH_SEL, ISWT_SEL, LOW_SEL, MED_SEL, OSWT_SEL,THR_SEL
Standard PID, ONOFF
Valve BV1, BV2, VDD, VMD, VSD, VSN, VSS
1-20 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
If you want power-fail processing to be invoked from any of the restart OBsinstead of or in addition to OB100, open the CFC and follow these steps:
1. Right-click on the name of the function block and select Go to InstalledPosition. The run-time editor starts.
2. Click the plus sign (+) to the left of the cyclic OB in which the block isinstalled, such as OB32 or OB35.
3. Right-click on the block name and select Copy.
4. Right-click on the restart OB (such as OB101) that you want to use forthe block and select Insert. The block is added to the list for the newrestart OB (Figure 1-6).
5. Repeat step 3 for all the restart OBs from which you want to have theblock called.
If you do not want power-fail processing for your blocks, delete anyreferences to the block from OB100 through OB105. Open the CFC andfollow these steps:
1. Right-click on the name of the function block and select Go to InstalledPosition. The run-time editor starts.
2. Click the plus sign (+) to the left of OB100 in the list to expand it.
3. Right-click on the block name in the expanded OB100 list to highlightit.
4. Click the Delete button. The block is removed from the OB100 list.
5. Repeat steps 2 through 4 for the other restart OBs. Press OK when youare finished.
NOTE: The battery backup on your S7 controller must be enabled in orderfor the controller to save data during a power failure.
1-21SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
CFC -- [Run-time editor -- CFAVS006\TI555\Charts]
Chart Edit Insert PLC Debug View Options Window Help
Press F1 for help.
CFC00003$UNIT0003\U3AVS002
CFC00003$UNIT0003\U3AVS002
OB102 [Cold restart]
OB105 [Standby startup]
OB11 [Time-of-day interrupt TOD_INT1]
OB1 [FZ Free cycle]
OB10 [Time-of-day interrupt TOD_INT0]
OB100 [Warm restart]
OB121 [PROG_ERR Programming error]
OB122 [MOD_ERR Access error]
OB13 [Time-of-day interrupt TOD_INT3]
OB14 [Time-of-day interrupt TOD_INT4]
OB15 [Time-of-day interrupt TOD_INT5]
OB16 [Time-of-day interrupt TOD_INT6]
OB17 [Time-of-day interrupt TOD_INT7]
OB20 [Time-delay interrupt]
OB21 [Time-delay interrupt]
CFC00003$UNIT0003\U3AVS002 AVG_SEL 1/-- Average selector
Contents of ’OB101\’ Type Pos Comment
OB35 [Start]
✂
OB101 [Hot restart]
CFC00003$UNIT0003\U3AVS001
OB12 [Time-of-day interrupt TOD_INT2]
OB22 [Time-delay interrupt]
OB23 [Time-delay interrupt]
OB30 [Cyclic interrupt CYC_INT0]
OB32 [Cyclic interrupt CYC_INT2]
OB31 [Cyclic interrupt CYC_INT1]
Figure 1-6 Adding a Block to the Restart OB
1-22 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
1.4 Creating Tags from Function Blocks
When you create an S7 program, you move blocks that you want to use astags in OSx from the OSx Library into a CFC, where you configure themand link them to other parts of the S7 program. You then need to markthese function blocks before you can transfer them to the OSx database. Thename of the S7 program name must be identical to the control node name asconfigured on the OSx.
NOTE: When you place a function block in a CFC, the block is assigned adefault tag name, which is a numerical value. You must change this value toits OSx tag name, which cannot be just a number.
To mark the blocks and assign the tag name, follow these steps:
1. Double-click the left mouse button on the title bar of the function block.The Block Object Properties dialog box appears (Figure 1-7).
2. In the Name field, enter a unique name for the tag. The length of thetag name must be 12 characters or less and can contain no spaces. Thetag name can contain only letters, numbers, and underscore characters.It is recommended that you use only lower-case letters. The tag namecannot be just a number.
The tag name that you configure here appears in the upper left cornerof the function block in the CFC editor.
3. Make sure that the Operator C & M Possible field is checked. This isthe default for OSx library blocks.
No user configuration is required in the Import/Export Assistant fieldor for the Message button. Changes made from the Message button mayresult in warnings during the transfer process.
4. Click the Operator control and monitoring... button. The Operator Controland Monitoring window appears. The tag name appears in the Namefield preceded by its path in the STEP 7 hierarchy.
This procedure continues on page 1-24.
Marking FunctionBlocks
Continue onPage 1-24.
1-23SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Block object properties: FLAV_DEVS.vlv1_0
General
Type:
Name:
Comment:
Inputs:Internal Identifier:Instance DB:Name (header):Family:Author:
To be installed in OB/tasks:23FB347DB48VSNCONTROLOSxLib
VSN
vlv1_0
Chocolate flavor feed valve
Operator C and M possible
Special object properties Import/Export Assistant
IEA Messages...
I/Os
Message...
Operator C and M...
OK HelpCancel
Figure 1-7 Block Object Properties
1-24 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
Creating Tags from Function Blocks (continued)
5. You can enter a tag description for OSx purposes in the Comment fieldof the Operator Control and Monitoring window (Figure 1-8). The tagdescription in the Comment field of the General folder of Block ObjectProperties (Figure 1-7) is for the CFC only and does not appear in OSx.
You can also enter one or more of the following tag parameters,separated by spaces: parent unit, manual set, engineering units,autolog, and upload. See page 1-26 for descriptions of these parameters.
No spaces are allowed within each tag parameter assignment. If thestring you are assigning to a text tag attribute contains spaces, enclosethe string in single quotation marks; for example:
text_1=’Unit operation complete.’
Multiple lines are permitted. You can also enter a comment here fordocumenting your program.
6. Click OK to save. Click OK on the Block Object Properties dialog box toexit.
1-25SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Operator Control and Monitoring
General WinCC Attributes
Name:
Comment: Chocolate Flavor Feed Valve@MAN=Y PAR=tag123 setpoint=A timeout_1=U
S7_Program(1)_FLAV_DEVS_vlv1_0
Description
OK Cancel Help
Figure 1-8 Operator Control and Monitoring Window
1-26 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
Creating Tags from Function Blocks (continued)
The OSx tag parameters that you can enter in the Comment field of theOperator Control and Monitoring window are described below. You can deferthis configuration until the tags are installed in the OSx database. Once thetags are installed, you can select a tag in the Tag Configurator and makethe appropriate assignments. Keep in mind, however, that any changes youmake after the transfer will be overwritten the next time the file istransferred from STEP 7.
NOTE: The content of the Comment field of the Operator Control andMonitoring window is transferred to OSx when the function block is mappedto OSx. Any change to the Comment field does not take effect until the nextmapping.
The Comment field parameters are case-sensitive and must be entered inuppercase letters; for example, MAN=Y.
Tag description All characters from the beginning of the field to amaximum of 30 characters or to the first occurrence of an “at” sign (@) aretranslated as the tag description. This means that the @ sign cannot be usedas part of the description itself.
If you do not include a description, you must still enter the @ sign if youwant to enter any other parameters for the tag.
Tag name change TGN=<OSx tag name>, where <OSx tag name> is thename to be used for the tag in OSx. You configure this parameter only if youwant the tag name in OSx to be different from the instance name in theEngineering Toolset.
Change CHANGE=<n>, where n is the new deadband value, between 0.0and 100.0; for example, CHANGE=2 for 2%. An OSx deadband is used tospecify the change (in percent of span) in the input value that is required forOSx to update the value in the database. The deadband is automatically setto a default of 1.0%. Set this deadband value to filter out noise in the inputsignal. This value is used only to provide a setting for the OSx system.
On a multi-station system, the values displayed for a tag attribute can differbetween stations by the percentage of the change setting. You can controlthis display of values by setting the default value of this parameter to alower number, such as 0.1 or 0.5. If it is important to observe everynumerical value change, you can even enter 0.0 for this value. However,entering 0.0 for too many attributes may cause a communications overloadon your system.
Configuring TagParameters in theComment Field
1-27SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Parent unit PAR=<unit tag name>, where <unit tag name> is the unittag used as the parent unit, if you assign the tag to a unit.
Manual set MAN=<Y or N> Enter Y if you want to be able to enter datamanually for the tag for trending purposes.
Engineering units U=<units>, where units can be a maximum of eightcharacters and are only applicable to the following tags: ALRM, AO, LOOP,TMR, CTR, CALC, and IVAR. If you include a space in the engineering unit,you must enclose the entire string in single quotes; for example,U=’cu ft’.
Autolog and Upload If you select autolog, a message is printed whenevera changed value for the attribute is sent to the database. When the statusattribute is specified for autolog, it is treated as an RBE tag if the OSxfunction block provides either an ALARM_8P or an ALARM_S messaging.
To improve network performance, select upload for ranges and alarm limitvalues that rarely or never change. This causes OSx to read the tagattribute at a slower rate, every other event scan period, compared to everyevent scan period for attributes without upload selected. Table 1-5 lists tagattributes that have upload as a default.
Table 1-5 Attributes with Upload as the Default
Tag Type Attributes
AI L_RANGE, H_RANGE, HH_ALM, H_ALM, L_ALM, LL_ALM, H_DEV,L_DEV, ROC_ALM
LOOP L_RANGE, H_RANGE, HH_ALM, H_ALM, L_ALM, LL_ALM, H_DEV,L_DEV, GAIN, RATE, RESET
AO, CTR, TMR L_RANGE, H_RANGE
Autolog and upload can be specified for any number of applicable tagattributes. To set these parameters for one or more tag attributes, follow thesyntax below:
• For autolog only, enter <attribute>=A
• For upload only, enter <attribute>=U
• For both autolog and upload, enter <attribute>=AU
Text strings (for text tags only) See Section 20.8.
1-28 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
Creating Tags from Function Blocks (continued)
Non-networked attributes Non-networked attributes for OSx can alsobe set in the Comment field of the Operator Control and Monitoring window.For example, to change the H_RANGE and L_RANGE limits for an IVAR,enter H_RANGE=<n> or L_RANGE=<n>, where n is the new value for thatlimit.
Table 1-6 lists the non-networked attributes for the standard OSx tag typesthat can be configured in the Operator Control and Monitoring window.
Table 1-6 Non-networked Attributes
Tag Attribute
AL_DEADBAND
AI CHANGE
UNITS
AOCHANGE
AOUNITS
CALCCHANGE
CALCUNITS
CTRL_RANGE
CTRUNITS
H_RANGE
IVAR L_RANGE
UNITS
AL_DEADBAND
LOOP CHANGE
UNITS
RECIPE AREASCALE_HIGH
RECIPE_AREASCALE_LOW
TEXT UNITS
TMRCHANGE
TMRUNITS
UNIT TYPE
1-29SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Process group GRO=<hex value> The hex value that you enter hererepresents the process groups to which the tag belongs; for example,GRO=0x0000004e. In OSx each tag is assigned by default to all 32 processgroups (0xFFFFFFFF). If you prefer to assign the tag to specific processgroups, see the discussion below for determining the value. For moreinformation about process groups in OSx, see the SIMATIC PCS 7 OSxProcess Configuration Manual.
To specify process group membership, enter a hex value in the Commentfield of the Operator Control and Monitoring window that represents theprocess groups to which the function block belongs. The value has the formGRO=0x00000000, where each digit represents four process groups(Figure 1-9).
0 x 0 0 0 0 0 0 0 0Process Groups:8 4 2 1
4 3 2 1
8 7 6 512 11 10 9
16 15 14 1320 19 18 1724 23 22 21
28 27 26 25
32 31 30 29
Hex value:
Figure 1-9 Hex Values for Process Groups
Table 1-7 shows examples of assigning individual process groups by hexnumber in the two left columns, and assigning multiple groups in the tworight columns. The hex number for multiple process groups is obtained byadding the individual group hex numbers together. Every possiblecombination of the 32 process groups produces a unique hex number.
Table 1-7 Examples of Process Group Assignment
Process Group Hex Number Process Groups Hex Number
1 0x00000001 1 and 2 0x00000003
2 0x00000002 1, 2, and 3 0x00000007
3 0x00000004 3 and 4 0x0000000C
4 0x00000008 1, 2, 3, and 4 0x0000000F
5 0x00000010 1, 2, 3, and 5 0x00000017
6 0x00000020 3, 4, and 6 0x0000002C
Calculating the HexNumber forProcess Groups
1-30 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
Creating Tags from Function Blocks (continued)
You can set an initial value for inputs and outputs for an OSx function blockin two separate property folders: the Block Object Properties I/O folder andthe WinCC Attributes folder. The initial value in each folder has a differentfunction. The initial value in the WinCC Attributes folder is used only withVersion 4.01 of the Engineering Toolset.
When you set the initial value of an input for a networked attribute in theBlock Object Properties I/O folder, that value is used for block execution andis placed in the OSx database when the system goes to the Operate state.Always provide an initial value for parameters, such as ranges and alarmlimits, that are not connected in the CFC.
For example, to set an initial value of 50.0 for the setpoint of a loop, enter50.0 in the Block Object Properties I/O folder for the SP input. (Thisexample assumes that the SP input is not cascaded or computed.) When thetag is installed in OSx, the setpoint is initially set to zero, but when thesystem goes to the Operate state, the value of 50.0 is uploaded to thedatabase.
The initial value in the WinCC Attributes folder is used only for the purposeof providing an intial value when the tag is installed in OSx. If you set theinitial value for a networked attribute in the WinCC Attributes folder, thatvalue is loaded in the OSx database when the tag is installed. However, thedatabase will be updated by the value in the Block Object Properties I/Ofolder when the system goes to the Operate state. Specifying a WinCCinitial value can be useful either for documentation or for viewing the tag inOSx when the system is in the Offline state.
For example, you set an initial value of 50.0 in the Block Object Propertiesfolder and an initial value of 70.0 in the WinCC Attributes folder. The tag isinstalled with a setpoint of 70.0 in the OSx database, but when the systemgoes to the Operate state, the value is updated to 50.0.
You can use the Value field in the Block Object Properties I/O folder to setthe initial value for OSx tag attributes and for block execution. Follow thesteps below:
1. Double-click the left mouse button on the title bar of the function block.The Block Object Properties dialog box appears.
2. Click the I/Os tab to display the list of inputs and outputs for the block(Figure 1-10).
3. Enter the values that you want use as initial values for block execution.
4. Click OK to confirm.
Initial Values forNetworkedAttributes
Configuring InitialValue in BlockObject Properties
1-31SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Block Object Properties: CFC1.3
Cancel HelpOK
General I/Os
I/OName Type Value Comment
ENEV_IDPROC_GRPSAND_MASKOR_MASKSTATUSHEALTHTIMEOUT_1TIMEOUT_2OVERRIDEMODE_CMDSETPOINTTPFAILRTLRTURHIGHRLOWRTCRESETMOPENMHIGHHIOLIODSBLD
ININININ_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUTIN_OUT
BOOLDWORDDWORDWORDWORDWORDWORDREALREALWORDWORDWORDBOOLBOOLBOOLBOOLBOOLBOOLBOOLBOOLBOOLBOOLBOOLBOOL
1
16#000016#000016#000016#00000.00.016#000016#000016#0000000000000000
Identify number for messageOSx Process GroupsOSx AND maskOSx OR maskPacked STATUS bitsHealth of alarm systemMaps to O_ALRM_TMaps to C_ALRM_TMaps to OVRDH/OVRDHPacked command bitsMaps to MOPEN/MHIGHTest powerfail bitRequest to lockRequest to unlockRequest to open highRequest to open lowRequest to closeRequest to resetManual openManual highOpen high feedbackOpen low feedbackForced to manual mode
16#FFFFFFFF16#00004E23
Figure 1-10 Setting Initial Value in the Block Object Properties I/O Folder
1-32 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
Creating Tags from Function Blocks (continued)
You can use the Initial Value field in the WinCC Attributes folder to set theinitial value for OSx tag attributes. Remember that, for a networkedattribute, this value will be overwritten by the value in the Block ObjectProperties I/O folder when the system goes to the Operate state.
To set the initial value in the WinCC Attributes folder, follow the stepsbelow:
1. Double-click the left mouse button on the title bar of the function block.The Block Object Properties dialog box appears.
2. Click the Operator Control and Monitoring button.
3. Click on the WinCC Attributes tab. The WinCC Attributes folder isdisplayed (Figure 1-11).
4. In the Initial Value field, click the box to check it, and enter the valuethat you want use as the initial value in the OSx database. Rememberthat, for a networked attribute, this value will be overwritten by thevalue in the Block Object Properties I/O folder when the system goes tothe Operate state.
5. Click OK to confirm.
Configuring InitialValue in WinCCAttributes
1-33SIMATIC PCS 7 OSx 4.1.2 Library The OSx Library of Blocks
Operator Control and Monitoring
Cancel HelpOK
General WinCC Attributes
LengthAttributes UL LL Initial Value
EV_ID
AND_MASK
OR_MASK
STATUS
HEALTH
TIMEOUT_1
TIMEOUT_2
MODE_CMD
SETPOINT
4294967295.
65535.
65535.
65535.
1.
65535.
3.40282346639e+038
3.40282346639e+038
--3.40282346639e+038
--3.40282346639e+038
Substitute Value0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
65535. 0.0.
0.
0. 0.6
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
1
2
4
4
4
2
2
2
2
x
Figure 1-11 Setting Initial Value in the WinCC Attributes Folder
1-34 SIMATIC PCS 7 OSx 4.1.2 LibraryThe OSx Library of Blocks
2-1SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
Chapter 2
I/O Control Blocks
2.1 I/O Control Blocks 2-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Overview 2-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Analog I/O 2-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Digital I/O 2-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Word I/O 2-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 AI (Analog Input) 2-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 AO (Analog Output) 2-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4 RTD (Resistive Temperature Detector) 2-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.5 TC (Thermocouple) 2-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.6 DI (Digital Input) 2-26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.7 DO (Digital Output) 2-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.8 WI (Word Input) 2-30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.9 WO (Word Output) 2-32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.10 BI (BCD Input) 2-34. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.11 BO (BCD Output) 2-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2-2 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
2.1 I/O Control Blocks
The function blocks in this chapter are designed to assist you in using yourfield I/O in the controller program. These function blocks provide elementsthat can be mapped to OSx tag types. This chapter describes the followingI/O block types:
• Analog
• Digital
• Word
Analog I/O values are 16-bit words that evaluate to one distinct signal. TheOSx Library provides two types of analog I/O blocks: analog input (AI) andanalog output (AO). Analog I/O are typically used with CFCs, but can alsobe monitored and changed in an SFC.
The OSx Library provides two special block types that are used withintelligent I/O modules, the Resistance Temperature Detector (RTD) and theThermocouple (TC).
Digital I/O values are 1-bit discrete values that evaluate to true or false.The OSx Library provides two types of digital I/O blocks: digital input (DI)and digital output (DO). Digital I/O blocks can be referenced in SFC stepsand transitions to detect and change the status of field equipment.
Word I/O values are 16-bit values that contain 16 different bits ofinformation. The OSx Library provides four types of word I/O blocks: wordinput (WI), word output (WO), binary-coded decimal input (BI), andbinary-coded decimal output (BO). BCD blocks can be used to displaymessages in BCD format in the operator interface.
Overview
Analog I/O
Digital I/O
Word I/O
2-3SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
2.2 AI (Analog Input)
The AI function block (FB440) receives a voltage or current signal from thefield that varies continuously over a specified range of voltages or currents.The inputs normally come from measuring devices, such as flow meters andpressure transmitters, and are proportional to the measured parameter.
The AI block translates to a CALC tag in OSx. See Section 20.2 for anexplanation of how to use the STATUS input for alarm messaging.
When you use an AI block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
If you want to use Series 500/505 I/O over the L2DP network, the inputvalues need to be scaled. For Series 500/505 I/O, three scaling options areavailable for analog input and output values: bipolar, 20% offset, and zerobias. See Table 2-1.
Table 2-1 Scaling for the AI Block
Scale Option Input RangeLow Range High Range
Scale Option Input RangeInput Value Integer Value Input Value Integer Value
Bipolar--10 to +10 volts --10 --32000 10 32000
Bipolar--5 to +5 volts --5 --32000 5 32000
1 to 5 volts 1 6400 5 32000
20% Offset 2 to 10 volts 2 6400 10 32000
4 to 20 milliamps 4 6400 20 32000
0 to 5 volts 0 0 5 32000
Zero Bias 0 to 10 volts 0 0 10 32000
0 to 20 milliamps 0 0 20 32000
Overview
Required Blocks
Scaling AnalogValues
2-4 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
AI (Analog Input) (continued)
To use an AI block with S7 I/O, set the AI_TYPE input to 0. No scaling isperformed on the IN input, and the input is passed directly to the OUToutput. If you require scaling on the I/O point, you use the scale functionblocks provided in the Engineering Toolset to connect to the IN input of theAI block. For example, you can use the SCL_BLK function block, as shownin Figure 2-1.
You use the AI block with S7 I/O to translate the input value to OSx as aCALC tag. Alternatively, the CALC function block (FB402) can be usedinstead of the AI block to provide an OSx tag.
ENO BO
ENABLD BO
OUT R
2OB35
BO EN
ScalerSCL_BLK
1
R LROUT
BO ENABL
BO REN
BO NRDY
R IN
R LRIN
BO RDIS
0
0
R HRIN
0
R HROUT
2/--
0.0100.0
0.01.0 ENO BO
OUT RSRV R
BTA BO
2OB35
BO EN
Meter1AI
1
R IN
BO FILTERR SAMPLE_TR HI_RANGE
I RAW
R H_RANGER L_RANGE
I SUB_TYPE
R LO_RANGE0.00
I AI_TYPE0.0
BO SQ_ROOT
1/--
100.00.0
00
0
Scale
“R1” MD100Analog Input
100.0
20
Figure 2-1 Using the AI Block with External Scaling
Using the AI Blockwith S7 I/O
2-5SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
To use an AI block with internal scaling, set the AI_TYPE input to 1. Scalingis performed on the RAW input before it is passed to the OUT output. TheRAW input is an integer that you connect to the field input word (IWx).
When you set the AI_TYPE input to 1, you can also select the FILTER andSQ_ROOT options.
• When the SQ_ROOT input is 1, it normalizes the incoming signal to avalue between 0 and 1, takes the square root, and then scales the valueas shown below for bipolar values.
0 to 1 value scale0 to 32000
− |value|--32000 to 0 --1 to 0 scale
Select the SQ_ROOT =1 if the input comes from a device (such as anorifice meter) that requires a square root calculation to scale its value.
• When the FILTER input is 1, it applies a first-order exponential filter ata rate determined by a specified time constant. If FILTER is used withthe SQ_ROOT input set to 1, the filter is applied before the square root.The following formula is used to process the value every time the blockexecutes:
OUT =---SAMPLE_TTM_CONST
× OUT+1− ---SAMPLE_TTM_CONST
× SRVThe TM_CONST input is a real number that indicates rate in seconds forfiltering. This input only applies if the FILTER input is 1.
SAMPLE_T is the sample time of the OB that calls the AI block. Seediscussion of SAMPLE_T on page 1-13.
SRV is the scaled raw value before the filter.
Using the AI Blockwith InternalScaling
2-6 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
AI (Analog Input) (continued)
To specify the range for the voltage or current input, set the SUB_TYPEinput as follows:
• 0 — Zero bias (default): 0 to 5 V, 0 to 10 V, or 0 to 20 mA
• 1 — Bipolar: --5 to 5 V, --10 to 10 V
• 2 — 20% offset: 1 to 5 V, 2 to 10 V, or 4 to 20 mA
The LO_RANGE input is entered as a real number indicating the low rangeof the input value in engineering units. This value must be less than theHI_RANGE input. The HI_RANGE input is entered as a real numberindicating the high range of the input value in engineering units. This valuemust be greater than the LO_RANGE input.
The H_RANGE and L_RANGE inputs default to 100.0 and 0.0 respectively.Change these inputs to the same values as the HI_RANGE and LO_RANGEsettings described above. The H_RANGE and L_RANGE inputs have no effecton the operation of the function block; they are used for displaying thescaled value on the OSx station.
The AI function block is shown in Figure 2-2, and its inputs and outputs aredescribed in Table 2-2 and Table 2-3.
OB351
BO EN
Ai_2
AI
ENO BO1
Analog Input
OUT R0 I AI_TYPE
SRV RI SUB_TYPE2
BO SQ_ROOT0
100.0 R HI_RANGE
BO FILTER0
R SAMPLE_T0.1
R LO_RANGE0.0
0 I RAW
R IN0.0
BTA BO
Figure 2-2 AI Block
Setting the Range
The AI Block
2-7SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
Table 2-2 Input Table for AI
Element Description Type InitialValue
EN Enable BOOL 1
H_RANGE ** High range attribute for OSx REAL 100.0
L_RANGE ** Low range attribute for OSx REAL 0.0
AI_TYPE AI processing type (0=none, 1=500/505) INT 0
SUB_TYPE AI scaling type (0=0, 1=Bipolar, 2=20%offset) INT 2
SQ_ROOT Perform square root calculation BOOL 0
FILTER Perform noise filtering BOOL 0
SAMPLE_T * Block sample time REAL 0.1
HI_RANGE High range of the input REAL 100.0
LO_RANGE Low range of the input REAL 0.0
RAW Raw input from module INT 0
IN Input REAL 0.0
BTA_LIM ** Broken transmitter low limit INT 6400
BTA_HYST ** Broken transmitter hysteresis REAL 0.1
TM_CONST ** Time constant REAL 1.0
* See discussion of SAMPLE_T on page 1-13.
** These inputs are invisible. To make an input visible see the procedure onpage 1-14.
Table 2-3 Output Table for AI
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Scaled filtered output value REAL 0.0
SRV Raw scaled value before the filter REAL 0.0
BTA Broken transmitter alarm BOOL 0
2-8 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
2.3 AO (Analog Output)
The AO function block (FB406) sends a signal from the controller to aprocess control device that provides modulation information for fieldequipment. Analog outputs normally go to analog display meters andproportional control valves. Use the AO function block only when you wantto have an analog output known to OSx.
Connect your process output to the block input IN. An output called OUT hasbeen placed on the block interface so that you can connect the block to afield device or use it as an input to other objects. During block operation, thevalue of IN is copied to OUT. Be aware that if this object is called from one ofthe longer cyclic interrupt OBs, signal propagation could be delayed.
Two other block parameters, STATUS and MODE, are available for use asinterlocks. A change to the most significant bit of STATUS generates analarm to OSx if the status attribute has been configured for autologging inthe Comment field of the Operator Control and Monitoring dialog box.MODE is available for OSx to command the AO. You must supply allnecessary logic for STATUS and MODE.
An OSx deadband is used to specify the change (in percent of span) in theinput value required for OSx to update the value in the database. Thedeadband is automatically set to a default of 1.0%. You can change thedeadband value in the Comment field of the Operator Control & Monitoringdialog box by entering CHANGE=<n>, where n is the new deadband valuebetween 0.0 and 1.0. Set this deadband value to filter out noise in the inputsignal. This value is used only to provide a setting for the OSx system. TheAO function block does not use this value for any calculation.
NOTE: Whenever you place an AO function block in CFC, a data block isused to store the value of the AO as well as OSx alarming information.Overuse of the AO block could cause you to exhaust the supply of availabledata blocks on the controller and tie up S7 message resources.
Configure engineering units for the output of the AO block in the Commentfield of the Operator Control and Monitoring window. See page 1-26.
When you use an AO block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
2-9SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
The AO function block is shown in Figure 2-3, and its inputs and outputsare described in Table 2-4 and Table 2-5.
OB351
BO EN
ao_12
AO
ENO BO1
Analog Output
OUT R
16#0 W STATUS
R H_RANGE100.0
MODE WR L_RANGE0.0
R IN0.0
Figure 2-3 AO Block
Table 2-4 Input Table for AO
Element Description Type InitialValue
EN Enable BOOL 1
H_RANGE High range attribute REAL 100.0
L_RANGE Low range attribute REAL 0.0
STATUS Packed status bits WORD 16#0
IN Input REAL 0.0
Table 2-5 Output Table for AO
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output REAL 0.0
MODE OSx mode commands WORD 16#0
The AO Block
2-10 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
2.4 RTD (Resistive Temperature Detector)
The RTD function block (FB434) receives a signal from the field to thecontroller that represents an analog-to-digital conversion of the inputtemperature. This function block is used specifically for the inputs to anRTD module.
You can configure the RTD block to convert the incoming data in threedifferent ways using the RT_TYPE input as shown below:
• 0 — No conversion is done on the incoming data.
• 1 — Perform 500 series RTD module conversion.
• 2 — Perform 505 series RTD module conversion.
If the RT_TYPE input is set to 0, the value of the IN input will be transferreddirectly to the OUT output. If RT_TYPE input is set to 1 or 2, then the RAWinput is converted and then transferred to the OUT output.
The RTD block translates to a CALC tag in OSx. See Section 20.2 for anexplanation of how to use the STATUS input for alarm messaging.
When you use an RTD block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
2-11SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
To use an RTD block with S7 I/O, set the RT_TYPE input to 0. No conversionis performed on the IN input, and the input is passed directly to the OUToutput. If you require conversion on the I/O point, use the SCL_BLKfunction block, as shown in Figure 2-4.
You use the RTD block with S7 I/O to translate the input value to OSx as aCALC tag. Alternatively, the CALC function block (FB402) can be usedinstead of the AI block to provide an OSx tag.
ENO BO
ENABLD BO
OUT R
2OB35
BO EN
ScalerSCL_BLK
1
R LROUT
BO ENABL
BO REN
BO NRDY
R IN
R LRIN
BO RDIS
0
0
R HRIN
0
R HROUT
2/--
--200.001000.00
0.01.0 ENO BO
OUT RSRV R
BTA BO
2OB35
BO EN
Well_tempRTD
1
R IN
C OHM_RNGC RANGE
BO FILTER
I RAW
C RTD_TYP
R SAMPLE_T0.10
I RT_TYPE
C ENG_UNIT
1/--
o
’F’’A’’C’
0
Scale
“R1” MD100Resistive Temp
’P’0
C STRT_TMP’A’
Figure 2-4 Using the RTD Block with S7 I/O
Using the RTDBlock with S7 I/O
2-12 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
RTD (Resistive Temperature Detector) (continued)
To use an RTD block with a 500 Series RTD, set the RT_TYPE input to 1.Conversion is performed on the RAW input before it is passed to the OUToutput. The RAW input is an integer that you connect to the field input word(IWx).
When you set the RT_TYPE input to 1, you can also use the inputs asdescribed below.
You set the BTA_LIM input in the Block Properties I/O folder. Set theBTA_LIM input to an integer value, so that when the RAW input is less thanthe BTA_LIM, the BTA (broken transmitter alarm) output is set. The typicalBTA threshold of 500 Series RTD is less than --3300.
You set the RTD_TYPE input to the code that represents the mode ofoperation of the RTD as listed below:
• ’1’ — 100 ohm Platinum 0.003850 ohm/ohm/C
• ’2’ — 100 ohm Platinum 0.003916 ohm/ohm/C
• ’3’ — 100 ohm Platinum 0.003902 ohm/ohm/C
• ’4’ — 100 ohm Nickel 0.006720 ohm/ohm/C
• ’5’ — 100 ohm Platinum 0.003900 ohm/ohm/C
When the FILTER input is 1, it applies a first-order exponential filter at arate determined by a specified time constant. The following formula is usedto process the value every time the block executes:
OUT =---SAMPLE_TTM_CONST
× OUT+1− ---SAMPLE_TTM_CONST
× SRVThe TM_CONST input is a real number that indicates rate in seconds forfiltering. This input only applies if the FILTER input is 1.
SAMPLE_T is the sample time of the OB that calls the RTD block. Seediscussion of SAMPLE_T on page 1-13.
SRV is the scaled raw value before the filter.
Using the RTDBlock with 500Series I/O
2-13SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
You set the ENG_UNITS input to the code that represents the output formatas listed below:
’C’ — Degrees Centigrade ’F’ — Degrees Fahrenheit
’O’ — Ohms ’I’ — Integer
If you set the ENG_UNITS input to ’I’, you use the RANGE input to representthe temperature range that is being monitored. The RANGE input onlyapplies if the ENG_UNITS input is ’I’. The default for RANGE is ’F’. Theoptions for the RANGE input are listed below:
’F’ — Full 1000 deg C. ’H’ — Half 500 deg C.
’Q’ —Quarter 250 deg C.. ’E’ — Eighth 125 deg C.
The H_RANGE and L_RANGE inputs default to 32000.0 and 0.0 respectively.Change these inputs to reflect the range setting described above. Forexample, if the range is ’H’, then set H_RANGE to 500.0 and L_RANGE to 0.0.These inputs have no effect on the operation of the function block; they areused for displaying the scaled value on the OSx station.
If you set the ENG_UNITS input to ’I’, you use the STRT_TMP (startingtemperature) input to represent the lowest temperature value that is beingmonitored. The STRT_TMP input only applies if the ENG_UNITS input is ’I’.The default for STRT_TMP is ’A’. The options for the STRT_TMP input arelisted below:
’A’ — --200 deg C. ’E’ — 300 deg C.
’B’ — --75 deg C. ’F’ — 425 deg C.
’C’ — 50 deg C. ’G’ — 550 deg C.
’D’ —175 deg C. ’H’ — 675 deg C.
Some options cannot be used together. For example, you cannot set theRANGE input to ’F’ and the STRT_TMP input to ’B’ through ’H’. If an invalidcombination is detected, the OUT value is frozen at the last valid value andthe ENO output is set to 0.
2-14 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
RTD (Resistive Temperature Detector) (continued)
To use an RTD block with a 505 Series RTD, set the RT_TYPE input to 2.Conversion is performed on the RAW input before it is passed to the OUToutput. The RAW input is an integer that you connect to the field input word(IWx).
When you set the RT_TYPE input to 2, you can also use the inputs asdescribed below.
You set the BTA_LIM input in the Block Properties I/O folder. Set theBTA_LIM input to an integer value, so that when the RAW input is greaterthan BTA_LIM, the BTA (broken transmitter alarm) output is set. The typicalBTA threshold of 505 Series RTD is greater than 32751.
You set the RTD_TYPE input to the code that represents mode of operation ofRTD as listed below:
• ’P’ — Platinum
• ’N’ — Nickel
• ’C’ — Copper
When the FILTER input is 1, it applies a first-order exponential filter at arate determined by a specified time constant. The following formula is usedto process the value every time the block executes:
OUT =---SAMPLE_TTM_CONST
× OUT+1− ---SAMPLE_TTM_CONST
× SRVThe TM_CONST input is a real number that indicates rate in seconds forfiltering. This input only applies if the FILTER input is 1.
SAMPLE_T is the sample time of the OB that calls the RTD block. Seediscussion of SAMPLE_T on page 1-13.
SRV is the scaled raw value before the filter.
Using the RTDBlock with 505Series I/O
2-15SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
You set the ENG_UNITS input to the code that represents the output formatas listed below:
• ’C’ — Degrees Centigrade: different ranges for the different RTD types
• ’F’ — Degrees Fahrenheit: different ranges for the different RTD types
Platinum Copper Nickel
oC --200.0 to 850.0 --200.0 to 260.0 --80.0 to 275.0
oF --328 to 1562.0 --328.0 to 500.0 --112.0 to 527.0
• ’I’ — Integer: scaled integer Range 0.0 to 32000.0
• ’O’ — Ohms: Resistance measurements
If ENG_UNITS is set to ’O’, you set the OHM_RNG input to the code thatrepresents the resistance range. The character ’A’ represents ohm x 100for a range of 1.0 to 2000.0 and the character ’B’ represent ohm x 10 fora range of 1.0 to 320.0 The OHM_RNG input only applies if ENG_UNITS isset to ’O’.
The H_RANGE and L_RANGE inputs default to 32000.0 and 0.0respectively. If you select ’O’ for ENG_UNITS, change these inputs toreflect the ohm range setting described in the previous paragraph. Forexample, if the ohm range is ’B’, then set H_RANGE to 320.0 andL_RANGE to 1.0. These inputs have no effect on the operation of thefunction block; they are used for displaying the scaled value on the OSxstation.
2-16 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
RTD (Resistive Temperature Detector) (continued)
The RTD function block is shown in Figure 2-5, and its inputs and outputsare described in Table 2-6 and Table 2-7.
OB351
BO EN
Rtd_5
RTD
ENO BO1
Resistive Temp
OUT R0 I RT_TYPE
SRV IC RTD_TYP’P’
C ENG_UNIT’C’
’A’ C STRT_TMP
C OHM_RNG’A’
C RANGE’F’
BO FILTER0
0.1 R SAMPLE_T
I RAW0
BTA BO
R IN0.0
Figure 2-5 RTD Block
The RTD Block
2-17SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
Table 2-6 Input Table for RTD
Element Description Type InitialValue
EN Enable BOOL 1
H_RANGE ** High range attribute for OSx REAL 32000.0
L_RANGE ** Low range attribute for OSx REAL 0.0
RT_TYPE RTD processing type (0=none, 1=500,2=505) INT 0
RTD_TYP RTD type (1,2,3,4,5,P,N,C) CHAR ’P’
ENG_UNITS Engineering units (C=Deg. C, F=Deg F,O=Ohms, I=Integer) CHAR ’C’
OHM_RNG Ohm units ranges (A=A Range, B=BRange) CHAR ’A’
RANGE Integer range (F=Full, H=Half,Q=Quarter, E=Eighth) CHAR ’F’
STRT_TMP Start temperature (A--H) CHAR ’A’
FILTER Perform noise filtering BOOL 0
SAMPLE_T * Unit of block sample time REAL 0.1
RAW Raw input from module INT 0
IN Input REAL 0.0
TM_CONST ** Time constant REAL 1.0
BTA_LIM ** Broken transmitter threshold INT 32751
* See discussion of SAMPLE_T on page 1-13.
** These inputs are invisible. To make the inputs visible see the procedure onpage 1-14.
Table 2-7 Output Table for RTD
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Scaled filtered output value REAL 0.0
SRV Raw scaled value before the filter REAL 0.0
BTA Broken transmitter alarm BOOL 0
2-18 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
2.5 TC (Thermocouple)
The TC function block (FB435) receives a signal from the field to thecontroller that represents a thermocouple voltage. This function block isused specifically for the inputs to a TC module.
You can configure the TC block to convert the incoming data in threedifferent ways using the TC_TYPE input as shown below:
• 0 — No conversion is done on the incoming data.
• 1 — Perform 500 series TC module conversion.
• 2 — Perform 505 series TC module conversion.
If the TC_TYPE input is set to 0, the value of the IN input will be transferreddirectly to the OUT output. If TC_TYPE input is set to 1 or 2, then the RAWinput is converted and then transferred to the OUT output.
The TC block translates to a CALC tag in OSx. See Section 20.2 for anexplanation of how to use the STATUS input for alarm messaging.
When you use a TC block, the following function blocks must also be presentin the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
2-19SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
To use a TC block with S7 I/O, set the TC_TYPE input to 0. No conversion isperformed on the IN input, and the input is passed directly to the OUToutput. If you require conversion on the I/O point, use the SCL_BLKfunction block, as shown in Fig u r e 2- 6.
You use the TC block with S7 I/O to translate the input value to OSx as aCALC tag. Alternatively, the CALC function block (FB402) can be usedinstead of the AI block to provide an OSx tag.
ENO BO
ENABLD BO
OUT R
2OB35
BO EN
ScalerSCL_BLK
1
R LROUT
BO ENABL
BO REN
BO NRDY
R IN
R LRIN
BO RDIS
0
0
R HRIN
0
R HROUT
2/--
--200.00600.00
0.01.0 ENO BO
OUT RSRV R
BTA BO
2OB35
BO EN
Well_tempTC
1
R IN
C ENG_UNITC FORMAT
BO FILTER
I RAW
C THRMOTYP
R SAMPLE_T0.10
I TC_TYPE
C SPAN
1/--
0’I’
’C’’A’
0
Scale
“R1” MD100Thermocouple
’J’0
Figure 2-6 Using the TC Block with S7 I/O
Using the TC Blockwith S7 I/O
2-20 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
TC (Thermocouple) (continued)
To use a TC block with a 500 Series TC, set the TC_TYPE input to 1.Conversion is performed on the RAW input before it is passed to the OUToutput. The RAW input is an integer that you connect to the field input word(IWx).
When you set the TC_TYPE input to 1, you can also use the inputs asdescribed below.
You set the BTA_LIM input in the Block Properties I/O folder. Set theBTA_LIM input to an integer value, so that when the RAW input is less thanthe BTA_LIM, the BTA (broken transmitter alarm) output is set. The typicalvalue for the BTA threshold for a 500 Series TC is less than --32512.
You set the THRMOTYP input to the code that represents the type of input tothe TC module as listed below:
’J’ — Probe Type J ’S’ — Probe Type S
’K’ — Probe Type K ’B’ — Probe Type B
’T’ — Probe Type T ’E’ — Probe Type E
’R’ — Probe Type R ’N’ — Probe Type N
The SPAN input represents a voltage span for millivolt inputs, or atemperature span for thermocouple inputs. The valid inputs for SPAN are’A’, ’B’, ’C’, and ’D’. The default is ’A’. For more information about thesespans, see the manual that comes with the thermocouple module. Set theH_RANGE and L_RANGE inputs to reflect these values. These inputs have noeffect on the operation of the function block; they are used for displaying thescaled value on the OSx station.
Using the TC Blockwith 500 Series I/O
2-21SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
When the FILTER input is 1, it applies a first-order exponential filter at arate determined by a specified time constant. The following formula is usedto process the value every time the block executes:
OUT =---SAMPLE_TTM_CONST
× OUT+1− ---SAMPLE_TTM_CONST
× SRVThe TM_CONST input is a real number that indicates rate in seconds forfiltering. This input only applies if the FILTER input is 1.
SAMPLE_T is the sample time of the OB that calls the TC block. Seediscussion of SAMPLE_T on page 1-13.
SRV is the scaled raw value before the filter.
You set the ENG_UNIT input to the code that represents the temperatureformat as listed below:
’C’ — Degrees Centigrade
’F’ — Degrees Fahrenheit
Set the FORMAT input to the character that represents the output format aslisted below:
’S’ — Corresponds to the thermocouple “Degree” format
’I’ — Corresponds to the thermocouple “Integer” format
Some options cannot be used together. For example, you cannot setTHRMOTYP equal to ’R’ when SPAN is not in millivolts. If an invalidcombination is detected, the OUT value is frozen at the last valid value andthe ENO output is set to 0.
2-22 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
TC (Thermocouple) (continued)
To use a TC block with a 505 Series TC, set the TC_TYPE input to 2.Conversion is performed on the RAW input before it is passed to the OUToutput. The RAW input is an integer that you connect to the field input word(IWx).
When you set the TC_TYPE input to 2, you can also use the inputs asdescribed below.
You set the BTA_LIM input in the Block Properties I/O folder. Set theBTA_LIM input to an integer value, so that when the RAW input is greaterthan BTA_LIM, the BTA (broken transmitter alarm) output is set. The typicalBTA threshold for a 505 Series TC is greater than 32751.
You set the THRMOTYP input to the code that represents the type of input tothe TC module as listed below:
’J’ — Probe Type J ’S’ — Probe Type S
’K’ — Probe Type K ’E’ — Probe Type E
’T’ — Probe Type T ’N’ — Probe Type N
’R’ — Probe Type R
The SPAN input represents a temperature span for thermocouple inputs.The only valid input for SPAN for a 505 TC is ’A’. For more informationabout this span, see the manual that comes with the thermocouple module.Set the H_RANGE and L_RANGE inputs to reflect these values. These inputshave no effect on the operation of the function block; they are used fordisplaying the scaled value on the OSx station.
When the FILTER input is 1, it applies a first-order exponential filter at arate determined by a specified time constant. The following formula is usedto process the value every time the block executes:
OUT =---SAMPLE_TTM_CONST
× OUT+1− ---SAMPLE_TTM_CONST
× SRVThe TM_CONST input is a real number that indicates rate in seconds forfiltering. This input only applies if the FILTER input is 1.
SAMPLE_T is the sample time of the OB that calls the TC block. Seediscussion of SAMPLE_T on page 1-13.
SRV is the scaled raw value before the filter.
Using the TC Blockwith 505 Series I/O
2-23SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
You set the ENG_UNIT input to the code that represents the temperatureformat as listed below:
’C’ — Degrees Centigrade
’F’ — Degrees Fahrenheit
Set the FORMAT input to the character that represents the output format aslisted below:
’S’ — Corresponds to the thermocouple “Engineering Units” format
’I’ — Corresponds to the thermocouple “Scaled Integer” format
Some options cannot be used together. For example, you cannot setTHRMOTYP equal to ’R’ when SPAN is not ’A’. If an invalid combination isdetected, the OUT value is frozen at the last valid value and the ENO outputis set to 0.
2-24 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
TC (Thermocouple) (continued)
The TC function block is shown in Figure 2-7, and its inputs and outputsare described in Table 2-8 and Table 2-9.
OB351
BO EN
Tc_8
TC
ENO BO1
Thermocouple
OUT R0 I TC_TYPE
SRV RC THRMOTYP’J’
C SPAN’A’
C ENG_UNIT’C’
C FORMAT’I’
BO FILTER0
0.1 R SAMPLE_T
I RAW0
BTA BO
R IN0.0
Figure 2-7 TC Block
The TC Block
2-25SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
Table 2-8 Input Table for TC
Element Description Type InitialValue
EN Enable BOOL 1
H_RANGE ** High range attribute REAL 32000.0
L_RANGE ** Low range attribute REAL 0.0
TC_TYPE TC processing type (0=none, 1=500,2=505) INT 0
THRMOTYP Thermocouple type (J, K, T, R, S, B, E, N) CHAR ’J’
SPAN Temperature span (A, B, C, D) CHAR ’A’
ENG_UNIT Engineering units (C=Deg. C, F=Deg F) CHAR ’C’
FORMAT Value format (S=Engineering units,I=Scaled integer) CHAR ’I’
FILTER Perform noise filtering BOOL 0
SAMPLE_T * Unit of block sample time REAL 0.1
RAW Raw input from module INT 0
IN Input REAL 0.0
TM_CONST ** Time constant REAL 1.0
BTA_LIM ** Broken transmitter threshold INT 32751
* See discussion of SAMPLE_T on page 1-13.
** These inputs are invisible. To make the inputs visible see the procedure onpage 1-14.
Table 2-9 Output Table for TC
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Scaled filtered output value REAL 0.0
SRV Raw scaled value before the filter REAL 0.0
BTA Broken transmitter alarm BOOL 0
2-26 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
2.6 DI (Digital Input)
The DI function block (FB398) sends a signal from the field to the controllerthat monitors the status of field equipment, such as the position of a valveor the input from a limit switch.
Use the DI function block only when you want to have a digital input orBoolean signal an event to OSx. A message is sent each time the inputchanges if the block is configured for alarming or autologging in OSx.
Connect the digital input to the block input IN. An output called OUT hasbeen placed on the block interface so that you can connect the input to otherobjects. During block operation, the value of IN is copied to OUT. Be awarethat if this object is called from one of the longer cyclic interrupt OBs, signalpropagation could be delayed.
NOTE: Whenever you place a DI function block in CFC, a data block is usedto store the status of the DI as well as OSx alarming information. Overuseof the DI block could cause you to exhaust the supply of available datablocks on the controller and tie up S7 message resources. If you have a largenumber of digital inputs that must be reported to OSx, consider using theDI10 object instead. (See Section 20.6.)
Unnecessary use of function blocks could cause you to exhaust the supply ofavailable data blocks on the controller and tie up alarm resources. To reducememory requirements on the controller, you can use symbols in place offunction blocks for tags that do not require alarm messaging.
When you use a DI block, the following function blocks must also be presentin the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
2-27SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
The DI function block is shown in Figure 2-8, and its inputs and outputs aredescribed in Table 2-10 and Table 2-11.
OB351
BO EN
di_6
DI
ENO BO1
Digital Input
OUT BOBO IN0
Figure 2-8 DI Block
Table 2-10 Input Table for DI
Element Description Type InitialValue
EN Enable BOOL 1
IN Input BOOL 0
Table 2-11 Output Table for DI
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output BOOL 0
The DI Block
2-28 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
2.7 DO (Digital Output)
The DO function block (FB399) sends a signal from the controller thatchanges the on/off state of field equipment.
Use the DO function block only when you want to have a digital output orBoolean signal an event to OSx, such as the commanding of a field device orillumination of a panel lamp. A message is sent each time the input changesif the block is configured for alarming or autologging in OSx.
Connect the process output to the block input IN. An output called OUT hasbeen placed on the block interface so that you can connect the block to thefield device or use it as an input to other objects. During block operation, thevalue of IN is copied to OUT. Be aware that if this object is called from one ofthe longer cyclic interrupt OBs, signal propagation could be delayed.
NOTE: Whenever you place a DO function block in CFC, a data block isused to store the status of the DO as well as OSx alarming information.Overuse of the DO block could cause you to exhaust the supply of availabledata blocks on the controller and tie up S7 message resources. If you have alarge number of digital outputs that must be reported to OSx, considerusing the DO10 object instead. (See Section 20.7.)
Unnecessary use of function blocks could cause you to exhaust the supply ofavailable data blocks on the controller and tie up alarm resources. To reducememory requirements on the controller, you can use symbols in place offunction blocks for tags that do not require alarm messaging.
When you use a DO block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
2-29SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
The DO function block is shown in Figure 2-9, and its inputs and outputsare described in Table 2-12 and Table 2-13.
OB351
BO EN
do_6
DO
ENO BO1
Digital Output
OUT BOBO IN0
Figure 2-9 DO Block
Table 2-12 Input Table for DO
Element Description Type InitialValue
EN Enable BOOL 1
IN Input BOOL 0
Table 2-13 Output Table for DO
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output BOOL 0
The DO Block
2-30 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
2.8 WI (Word Input)
The WI function block (FB430) receives a signal from the field that is aread-only integer. The WI block does not include scaling or filtering.
The OUT output of a WI block translates to an IVAR tag in OSx. SeeSection 20.3 for an explanation of how to use the STATUS input for alarmmessaging.
When you use a WI block, the following function blocks must also be presentin the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
2-31SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
The WI function block is shown in Figure 2-10, and its inputs and outputsare described in Table 2-14 and Table 2-15.
OB351
BO EN
Wi_9
WI
ENO BO1
Word Input
OUT WW IN16#0
Figure 2-10 WI Block
Table 2-14 Input Table for WI
Element Description Type InitialValue
EN Enable BOOL 1
IN Input word WORD 16#0
Table 2-15 Output Table for WI
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output word WORD 16#0
The WI Block
2-32 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
2.9 WO (Word Output)
The WO function block (FB431) sends a signal from the controller to aprocess control device that is a read/write integer. The WO function blockdoes not include scaling or filtering.
The H_RANGE and L_RANGE inputs are used to translate the IN input to areal value to be used in the OSx database.
The OUT output of the WO block translates to an AO tag in OSx. SeeSection 20.2 for an explanation of how to use the STATUS input for alarmmessaging.
When you use a WO block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
The WO function block is shown in Figure 2-11, and its inputs and outputsare described in Table 2-16 and Table 2-17.
OB351
BO EN
Wo_10
WO
ENO BO1
Word Output
OUT WR H_RANGE100.0
MODE WR L_RANGE0.0
W IN16#0
Figure 2-11 WO Block
Overview
Required Blocks
The WO Block
2-33SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
Table 2-16 Input Table for WO
Element Description Type InitialValue
EN Enable BOOL 1
H_RANGE High range attribute REAL 100.0
L_RANGE Low range attribute REAL 0.0
IN Input WORD 16#0
Table 2-17 Output Table for WO
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output WORD 16#0
MODE OSx mode commands WORD 16#0
2-34 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
2.10 BI (BCD Input)
The BI function block (FB432) receives a signal from the field thatrepresents a decimal number that has been coded into a binaryrepresentation.
The BI function blocks are most commonly used to get thumbwheelinformation into the controller program. The value of the IN input isconverted to an integer on the OUT output. If an invalid value is detected onthe IN input, the OUT value is frozen at the last valid value and the ENOoutput is set to 0.
The OUT output of a BI block translates to an IVAR tag in OSx. SeeSection 20.3 for an explanation of how to use the STATUS input for alarmmessaging.
When you use a BI block, the following function blocks must also be presentin the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
2-35SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
The BI function block is shown in Figure 2-12, and its inputs and outputsare described in Table 2-18 and Table 2-19.
OB351
BO EN
Bi_11
BI
ENO BO1
BCD Input
OUT IW IN16#0
Figure 2-12 BI Block
Table 2-18 Input Table for BI
Element Description Type InitialValue
EN Enable BOOL 1
IN Input word WORD 16#0
Table 2-19 Output Table for BI
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output integer INT 0
The BI Block
2-36 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
2.11 BO (BCD Output)
The BO function block (FB433) sends a signal to a process-control fielddevice such as a BCD display.
The BO function blocks are most commonly used to send information to anoperator panel display. The integer value of the IN input is converted to aBCD value on the OUT output. If an invalid value is detected on the IN input(>9999), the OUT value is frozen at the last valid value and the ENO outputis set to 0.
The OUT output of a BO block translates to an IVAR tag in OSx. SeeSection 20.3 for an explanation of how to use the STATUS input for alarmmessaging.
When you use a BO block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
2-37SIMATIC PCS 7 OSx 4.1.2 Library I/O Control Blocks
The BO function block is shown in Figure 2-13, and its inputs and outputsare described in Table 2-20 and Table 2-21.
OB351
BO EN
Bo_12
BO
ENO BO1
BCD Output
OUT WI INo
Figure 2-13 BO Block
Table 2-20 Input Table for BO
Element Description Type InitialValue
EN Enable BOOL 1
IN Input integer INT 0
Table 2-21 Output Table for BO
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output word WORD 16#0
The BO Block
2-38 SIMATIC PCS 7 OSx 4.1.2 LibraryI/O Control Blocks
3-1SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Chapter 3
Standard Control Blocks
3.1 Overview of Standard Control Blocks 3-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 PID (Proportional-Integral-Derivative) Loop 3-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Loop Control 3-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Required Blocks 3-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Loop Algorithm 3-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Standard PID Algorithm (Position Algorithm) 3-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Velocity Algorithm 3-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The PID Block 3-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .PID Inputs and Outputs 3-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Associated Math 3-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Loop Status 3-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3 ONOFF (On/Off) 3-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .On/Off Control 3-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Required Blocks 3-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The ONOFF Block 3-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ONOFF Inputs and Outputs 3-34. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Associated Math 3-37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4 ALRM (Analog Alarm) 3-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Overview 3-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Required Blocks 3-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The ALRM Block 3-41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ALRM Inputs and Outputs 3-45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Associated Math 3-46. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-2 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
3.1 Overview of Standard Control Blocks
The OSx Library provides three basic types of standard control blocks:
• PID blocks provide standard combinations of proportional, integral,and derivative control (Section 3.2).
• On/off blocks incorporate a high-gain PID loop and convert the outputto a Boolean value (Section 3.3).
• Analog alarm blocks provide a range check and alarming on an analoginput (Section 3.4).
3-3SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
3.2 PID (Proportional-Integral-Derivative) Loop
The PID function block (FB382) provides a combination of proportional,integral, and derivative control to calculate the value of an output.Figure 3-1 shows the basic operation of a continuous process loop.
Controldevice
+
--
Setpoint(target value)
Error
Process variable(sensed value)
Controller
Outputsignal
Process
Controlled variable
Figure 3-1 Process Control Loop
In a typical loop operation, a measured process variable is compared to asetpoint, or target value. The difference between these two values is theerror signal that the controller uses to calculate an output to the controldevice. The control device, in turn, manipulates the controlled variable thatserves as an input to the process.
When you use a PID block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_P (FB394)
• ALARM_8P (SFB35)
• RD_SINFO (SFC6)
• ADAPTER (FB393)
• ASC_PID (FB397), or any associated math block that you create
An associated math block must be specified for each PID block. If you do notrequire associated math, set the value of ASO_FB to the number of theplace-holding associated math block, ASC_PID. Then set the values ofASO_PV, ASO_AUTO, ASO_CAS, and ASO_OUT to 0.
Loop Control
Required Blocks
3-4 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
The output of a PID function block is based on the error (the relationshipbetween the setpoint and the process variable).
• In proportional control, the output is proportional to the error and isbased on the formula:
M= Kc E + Mx
M = output, E = error = setpoint --- process variable
Kc = gain =∆output∆input
where
• In integral control, the output is based on the integral of the error withrespect to time. Integral mode can be combined with proportionalcontrol or with proportional and derivative control. Integral controluses the formula:
M= TsTinJ=0
EJ
where Ts = sample time, Ti = reset time, E = error at time J
• In derivative control, the output is based on the rate of change of theprocess variable. Derivative control is never used alone, but always incombination with proportional and/or integral control:
M= ---TdTsdPVdt
where Ts = sample time, Td = rate time, PV = process variable
For all standard control blocks, you must specify a sample time thatdetermines how often the loop is updated. This sample time is a realnumber between 0.001 and 3.4x1038 seconds. See page 1-13 for a discussionof sample time (SAMPLE_T).
Loop Algorithm
3-5SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
The OSx Library provides the following two algorithms, which are availablewith PID blocks.
In the position algorithm, the position of the device being controlled iscomputed based on the error. The algorithm computes the value of theoutput for each loop calculation. For example, if the position algorithmcalculates that the valve needs to be 50% open, the output is 50%.
The position algorithm is the most commonly used and is based on theformula:
Mn = Kc En+ TsTinj=0 Ej− TdTs (PVn− PVn−1)+MxMn = output at time n, Kc = gain, En = error, Ej = error at time jwhere
Ts = sample time, Ti = reset time, Td = rate time
Mx = bias, PV = process variable
The velocity algorithm computes the change in the device position based onthe error. The algorithm generates a change in output based on the currentposition. For example, if you want the valve 50% open and the currentposition is 40%, the output is 10%.
The velocity algorithm uses the formula:
∆Mn = Mn− Mn−1 = Kc En − En−1+ TsTi En−TdTs(PVn− 2PVn−1+ PVn−2)
Use the velocity algorithm only when you have a good understanding of thedigital control problem. You can only use the velocity algorithm withactuators that move by percentage. For example, an output of zero meansthat you hold to your current position.
The PID function block can be configured for the following combinations: P,PI, PID, I, and PD. In the following discussion of the PID block, PID refersto any of these combinations.
Standard PIDAlgorithm (PositionAlgorithm)
Velocity Algorithm
3-6 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
The PID function block is shown in Figure 3-2, and its inputs and outputsare described in Table 3-1 and Table 3-2. A more extensive discussion ofsome of these inputs and outputs begins on page 3-12.
If you do not use all of the I/O elements in a function block, or if you alwaysuse certain elements the same way, you can set them to the appropriatevalue and then make them invisible. The elements are still present andfunctioning in the block, but they are not displayed in the CFC, giving thefunction block a less cluttered appearance. The following inputs on the PIDfunction block, for example, are rarely used, and can be made invisible tosimplify its appearance in the CFC: REV_ACTING, SQ_ERR, DEADB_ERR,BIAS_FREEZE, DER_GAINL, VELO_ALG, LOOP_TYP, MAL_HL, MAL_HHLL,MDEV_YO, and MRCA. See page 1-14 for the procedure.
An OSx deadband is used to specify the change (in percent of span) in theinput value that is required for OSx to update the value in the database.The deadband is automatically set to a default of 1.0%. You can change thedeadband value in the Comment field of the Operator Control & Monitoringdialog box by entering CHANGE=<n>, where n is the new deadband valuebetween 0.0 and 100.0. Set this deadband value to filter out noise in theinput signal. This value is used only to provide a setting for the OSx system.The PID function block does not use this value for any calculation.
Configure engineering units for the process variable of the PID block in theComment field of the Operator Control and Monitoring window. Seepage 1-26.
The PID Block
3-7SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
OB351
BO EN
R ALM_PRES
FB ASO_FB
BO ASO_PV
BO ASO_AUTO
BO ASO_CAS
loop_6
PID
ENO BO
MASTER_G BO
IMAN BO
IAUTO BO
ICASC BO
SERR BO
INHHA BO
INHA BO
INLA BO
INLLA BO
INYDA BO
INODA BO
INRCA BO
OVRUN BO
1
2.0
0
0
0
PID Control Bl
BO ASO_OUT
BO NRDY
BO RMAN
0
0
0
SMODE I
ERR R
LPV R
LSP R
LMN R
0 BO RCAS
0 BO RATO
BO GMAN
BO GAUTO
BO GCASC
0
0
0
R SAMPLE_T0.1
R PID_ST1.0
R SP0.0
R SPH
R SPL
1.0
0.0
R RSP0.0
R PV0.0
R PVH1.0
I SP_TYPE0
R PVL0.0
0
BO BTA0
BIAS_O R
(Figure continuedon next page.)
Figure 3-2 PID Block
3-8 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
R HHA
R HA
R LA
R LLA
R RCA
R KD
R OUT
I AWS
R HLIM
R LLIM
0.9
0.8
0.2
0.1
1.0
10.0
0.0
0
1.0
0.0
R KC
R TI
R TD
1.0
999.99
0.0
R BIAS0.0
R ADB0.01
BO MAL_HL1
BO MAL_HHLL
BO MDEV_YO
BO MRCA
BO REV_ACTI
BO SQ_ERR
BO DEADB_ER
BO BIAS_FRE
BO DER_GAIN
BO VELO_ALG
I LOOP_TYP
1
1
1
0
0
0
0
0
0
4
R ODA
R YDA
0.2
0.1
Figure 3-2 PID Block (continued)
3-9SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Table 3-1 Input Table for PID
Element Description Type InitialValue
EN Enable BOOL 1
ASO_FB FB number for associated function block FB 0
ASO_PV Enable associated math on PV cycle BOOL 0
ASO_AUTO Enable associated math during auto mode BOOL 0
ASO_CAS Enable associated math during cascade mode BOOL 0
ASO_OUT Enable associated math on loop output BOOL 0
RMAN Request manual mode BOOL 0
RATO Request automatic mode BOOL 0
RCAS Request cascade mode BOOL 0
GMAN Go to manual mode BOOL 0
GAUTO Go to automatic mode BOOL 0
GCASC Go to cascade mode BOOL 0
NRDY Block not ready BOOL 0
SAMPLE_T * Unit of sample time (in seconds) REAL 0.1
PID_ST PID sample time (in seconds) REAL 1.0
ALM_PRESET Alarm preset time (in seconds) REAL 2.0
SP_TYPE Setpoint type: 0 = none, 1 = cascaded, 2 = computed INT 0
SP Setpoint REAL 0.0
RSP Remote setpoint REAL 0.0
SPH Setpoint high limit REAL 1.0
SPL Setpoint low limit REAL 0.0
PV Process variable REAL 0.0
PVH PV high limit REAL 1.0
PVL PV low limit REAL 0.0
BTA Broken transmitter alarm BOOL 0
ADB Alarm deadband REAL 0.01
* See discussion of SAMPLE_T on page 1-13.
Table continues on next page.
3-10 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
Table 3-1 Input Table for PID (continued)
Element Description Type InitialValue
HHA High-high alarm limit REAL 0.9
HA High alarm limit REAL 0.8
LA Low alarm limit REAL 0.2
LLA Low-low alarm limit REAL 0.1
ODA Orange deviation limit REAL 0.2
YDA Yellow deviation limit REAL 0.1
RCA Rate-of-change limit REAL 1.0
VELO_ALG 1 = velocity algorithm, 0 = position algorithm BOOL 0
LOOP_TYPE Loop type: 0 = P, 1 = I, 2 = PI, 3 = PD, 4 = PID INT 4
KC Proportional gain REAL 1.0
TI Reset time (in minutes) REAL 999.99
TD Derivative time (in minutes) REAL 0.0
KD Derivative gain REAL 10.0
DER_GAINL Derivative gain limiting BOOL 0
REV_ACTING 1 = reverse acting, 0 = direct acting BOOL 0
SQ_ERR Control based on squared error BOOL 0
DEADB_ERR Control based on deadband error BOOL 0
BIAS_FREEZE Freeze bias when output is out of range BOOL 0
AWS Anti-reset windup INT 0
HLIM High limit for output REAL 1.0
LLIM Low limit for output REAL 0.0
OUT PID output (0.0 to 1.0) REAL 0.0
BIAS PID bias REAL 0.0
MAL_HL Monitor high and low alarms BOOL 1
MAL_HHLL Monitor high-high/low-low alarms BOOL 1
MDEV_YO Monitor yellow/orange deviations BOOL 1
MRCA Monitor rate-of-change alarm BOOL 1
3-11SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Table 3-2 Output Table for PID
Element Description Type InitialValue
ENO Output valid BOOL 0
MASTER_GMAN Output for setting the master to manual BOOL 0
IMAN Loop in manual mode BOOL 0
IAUTO Loop in auto mode BOOL 0
ICASC Loop in cascade mode BOOL 0
SERR Sign error: 1 = --, 0 = + BOOL 0
INHHA Loop in high-high alarm: PV > HHA BOOL 0
INHA Loop in high alarm: PV > HA BOOL 0
INLA Loop in low alarm: PV < LA BOOL 0
INLLA Loop in low-low alarm: PV < LLA BOOL 0
INYDA Loop in yellow deviation alarm: ERR > ABS(YDA) BOOL 0
INODA Loop in orange deviation: ERR > ABS(ODA) BOOL 0
INRCA Loop in rate-of-change alarm BOOL 0
OVRUN Loop overrunning BOOL 0
SMODE Block status INT 0
ERR Loop error REAL 0.0
BIAS_O Loop bias output REAL 0.0
LPV Internal PV REAL 0.0
LSP Internal SP REAL 0.0
LMN Internal output REAL 0.0
3-12 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
Further explanation of important inputs and outputs in the PID functionblock appears below:
Associated Math The ASO_FB, ASO_PV, ASO_AUTO, ASO_CAS, andASO_OUT inputs function together to enable you to do associated math witha PID block. They are discussed in more detail in the section on associatedmath on page 3-22.
Loop Modes The RMAN, RATO, and RCAS inputs are used to requestchanges to manual, automatic, and cascade mode, respectively, for the PIDblock. The corresponding GMAN, GAUTO, and GCASC inputs can also be usedfor this purpose. They are included in the OSx Library for completeness inreplicating APT functionality.
In manual mode, the loop algorithms are not performed, and the controlprogram or operator can manipulate the output directly by writing to theOUT input.
In automatic mode, the loop takes the setpoint from the SP (setpoint) input.Loop calculations are then performed, and the controller output is updated.
In cascade mode, the setpoint is provided by an external source, connectedto the RSP input. This source can be the output of another block, a declaredreal variable, or the output from another PID block.
In order to put a loop in cascade mode, follow this sequence:
1. Set the source (master) loop’s output to the target value (the setpointfor the slave loop).
2. Put the cascade (slave) loop in cascade mode.
3. Put the source (master) loop in automatic mode.
The master loop then feeds its output to the slave loop’s RSP input. If aslave loop is switched out of cascade, then all of its master loops must beplaced in manual. To achieve this control, connect MASTER_GMAN of theslave loop to GMAN of the master loop (Figure 3-3). A request to place amaster loop in auto or cascade is denied unless the slave loop is in cascade.
If the setpoint source is not configured as cascaded or computed, you cannotuse RCAS or GCASC.
PID Inputs andOutputs
3-13SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
GMAN
LMN RSP
MASTER_G
Slave Loop
Master Loop
Figure 3-3 Cascaded Loops
Not Ready When the NRDY input is set to true (1), no data is written toOUT or LMN, and you cannot place the loop into automatic or cascade mode.If either GAUTO or GCASC is held true in controller logic when NRDY is alsotrue, the loop cycles back and forth between manual mode and the alternate(automatic or cascade) mode.
Sample Time The SAMPLE_T and PID_ST inputs determine the frequencyof execution of the block. The loop OVRUN output becomes true when theloop cannot execute as quickly as you specified in the PID_ST time. Thissituation can occur if you set the PID_ST to a value smaller than theSAMPLE_T. See page 1-13 for more information.
Alarm Preset The ALM_PRESET input determines how often the PV-basedalarms (high-high, high, low, low-low) are processed. Alarms are processedat this rate or at the PID_ST rate, whichever is smaller. The default value issufficient for most applications.
3-14 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
Setpoint The SP_TYPE input can be one of the following:
• None (0) — Enter the setpoint at the SP input. This is the default.
• Cascaded (1) — The setpoint is the output of another PID functionblock.
• Computed (2) — The setpoint is the real output of any other functionblock.
The RSP input is used if the SP_TYPE is set to 1 (cascaded) or 2 (computed).The setpoint from the remote block is connected to the RSP input, and thencopied by the loop to the SP input.
The SPH input is a real number that indicates the maximum value of thesetpoint; it must be less than or equal to the high range of the PV. The SPLinput is a real number that indicates the minimum value of the setpoint; itmust be greater than or equal to the low range of the PV.
Process Variable The PV input is the scaled analog input or real inputthat represents the process variable. Integer inputs are not allowed. Abroken transmitter for the process variable must be detected by additionaluser-supplied logic, the result of which is connected to the BTA input.
High and Low Ranges The PVH and PVL inputs are real numbers inengineering units representing the high and low ranges, respectively, of thePV; they are used to scale the RSP input and to clamp the PV.
Broken Transmitter Alarm The BTA input provides a method fordetecting a broken transmitter. You can write your own logic to supply thisinput, or you can connect it to an I/O point provided by the inputtransmitter.
Alarm Deadband The ADB input is a real number in engineering units; itprevents the alarm from changing when the process variable is within thedeadband.
3-15SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Alarm Limits The PID function block provides low-low, low, high, andhigh-high alarms; see Figure 3-4. If the process variable is outside the limitsof the alarms, you can use the alarms to generate warnings and shutdownprocedures for the process equipment itself.
The HHA input is a real number in engineering units; it must be greaterthan or equal to the high alarm value and less than or equal to the highrange of the PV. When the PV exceeds this value, the INHHA output becomestrue.
The HA input is a real number in engineering units; it must be less than orequal to the high high alarm value of the PV. When the PV exceeds thisvalue, the INHA output becomes true.
The LA input is a real number in engineering units; it must be less than orequal to the high alarm value of the PV. When the PV exceeds this value,the INLA output becomes true.
The LLA input is a real number in engineering units; it must be less than orequal to the low alarm value and greater than or equal to the low range ofthe PV. When the PV exceeds this value, the INLLA output becomes true.
Low alarm
Low-low alarm
High-high alarm
High alarm
Alarm deadband
Alarm deadband
Alarm deadband
Alarm deadband
Processvariable
high alarm low alarm
Figure 3-4 Process Variable Alarms
3-16 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
Deviation Alarms Deviation alarms (yellow/low and orange/high) refer tothe specified tolerance around the setpoint; that is they check to seewhether the process variable is within a desired range of the setpoint. Theyellow and orange deviation zones move up and down with the setpoint as itchanges (see Figure 3-5). The yellow/low deviation is closer to the setpoint,and the orange/high deviation is farther away from the setpoint.
The alarm deadband that you specified for the process variable alarmsoperates around the deviation alarms also.
The deviation alarms can be used as indicators to show how well the loop iscontrolling, or they can be used as limits to activate some procedure.
The YDA (yellow deviation alarm) input is a real value that indicates themaximum allowable error (SP--PV) before the yellow deviation zone isreached. When the PV reaches the yellow deviation zone, the INYDA outputbecomes true.
The ODA (orange deviation alarm) input is a real value that indicates themaximum allowable error (SP--PV) before the orange deviation zone isreached. When the PV reaches the orange deviation zone, the INODA outputbecomes true.
Setpoint
Yellow deviation
Yellow deviation
Orange deviation
Orange deviation
deadband
deadband
deadband
deadband
Figure 3-5 Setpoint Deviation Alarms
3-17SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Rate-of-Change Alarm The RCA input is a real number in engineeringunits per minute that is used to set the rate-of-change alarm. When the PVexceeds the allowable rate of change (RCA), the INRCA output becomes true.
Position and Velocity Algorithms Set the VELO_ALG input to true (1)to select the velocity algorithm. The default is the position algorithm (0).See page 3-5 for a description of these algorithms.
Loop Type Specify the loop type for the LOOP_TYPE input: 0 = P, 1 = I,2 = PI, 3 = PD, 4 = PID. The type of loop you choose determines whichtuning constants are available to you.
When the loop type is not PID, the function block continuously supplies anappropriate value in the controller. When the loop type has no proportional(P) term, the KC input is 1.0. When the loop type has no integral (I) term,the TI input is infinity. When the loop type has no derivative (D) term, theTD input is zero.
Proportional Gain The KC input is an integer between 0 and 100 thatindicates proportional gain in % / %. The default is 1.0.
Integral Time (Reset Time) The TI input is a real number between 0.0and infinity that indicates reset time of integral mode in minutes. Thedefault is 999.99.
Derivative Time (Rate) The TD input is a real number between 0.0 andinfinity that indicates the derivative time (rate) in minutes. The default is0.0.
3-18 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
Derivative Gain Limiting The KD input is a real number between 5.0and 30.0 that indicates the coefficient of derivative gain limiting. Thedefault is 10.0. Set DER_GAINL input to true (1) to enable derivative gainlimiting with the KD input.
In the standard PID algorithm, the algorithm responds excessively toprocess noise if the coefficient of the derivative term (Td/Ts) is significantlyabove the 10 to 20 range. This causes disturbances that lead to erraticbehavior of the process.
To solve this problem, the controller allows you the option of specifying aderivative gain limiting coefficient (the KD input). The use of this coefficientenables the process variable to be filtered with a time constant that isproportional to the derivative time (the TD input). The PID equations withthe derivative gain limiting coefficient are shown in Figure 3-6.
Yn
Mx
M
= Yn−1 + TsTs + (Td∕Kd)
× PVn − Yn−1
= Ki × en + Mxn−1
= Kc × en − Kr (Yn− Yn−1) + Mx
Position Algorithm
Yn
∆Mn
= Yn−1 + TsTs + (Td∕Kd)
× PVn − Yn−1
= Kc × (en − en−1) + Ki × en − Kr × (Yn − 2 × Yn−1 + Yn−2
)Velocity Algorithm
Variable Definition Variable Definition
Mn Loop output en Error (SP -- PV)
Mxn Bias (Mx is the initial valve position) Td Rate time
Kc Proportional gain Ti Reset time
Kd Derivative gain-limiting coefficient Ts Sample time
Ki Integral gain, Kc (Ts/Ti) Yn Filtered PV
Kr Rate gain, Kc (Td/Ts) PVn Process variable
M Calculated output Mx Calculated bias
Figure 3-6 PID Algorithms
3-19SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Direct and Reverse-Acting Algorithms The control calculation in thePID function block can be either direct acting or reverse acting. To specify areverse-acting control algorithm, set the REV_ACTING input to 1; fordirect-acting control, set the input to 0.
• Direct-acting control means that when you increase the setpoint, theoutput increases, and when you decrease the setpoint, the outputdecreases. The control action is relative to the change in loop error. Ifthe error increases, then the controller increases the output.
Example: An example of direct-acting control is heating a vessel with asteam jacket. When heating, the setpoint is higher than the PV,resulting in a positive error. To achieve optimum control, the PID firstassigns a large output value to the valve that controls the flow ofsteam, and then reduces the output value as the temperature in thevessel increases. The output to the steam valve continues to decreaseas the temperature increases until a steady-state output is reachedthat maintains the temperature at the setpoint.
• Reverse-acting control decreases the output if the setpoint is increased,and increases the output if the setpoint is decreased. The direction ofchange in the setpoint and output is opposite. If the error increases(goes positive), then the controller decreases the output.
Example: An example of reverse-acting control is cooling a vessel withcoolant in the jacket. When cooling, the setpoint is lower than the PV,resulting in a negative error. The PID achieves optimum control by firstassigning a large output value to the valve that controls the flow ofcoolant, and then reduces the output as the temperature in the vesseldecreases. The output to the coolant valve continues to decrease as thetemperature decreases until a steady-state output is reached thatmaintains the temperature at the setpoint.
There is one difference between reverse-acting calculations anddirect-acting calculations. In reverse-acting calculations, the tuningparameters have been negated to correct the control algorithm tocompensate for the reverse action.
3-20 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
Error Algorithm The ERR output reflects the difference between thesetpoint and the process variable. The SERR output is true (1) when theerror (SP--PV) is negative, and false (0) when the error is positive.
The error algorithm can be normal, squared, or deadband:
• Normal error algorithm provides control based on the value of theerror. To specify a normal error algorithm, set both the SQ_ERR inputand the DEADB_ERR input to 0. This is the default.
• Squared error algorithm provides control based on the value of thesquare of the error. This produces a control equation that is lessresponsive than normal error control. To specify a squared erroralgorithm, set the SQ_ERR input to 1.
• Deadband error algorithm provides control based on an error deadbandthat eliminates gain for small errors within the deadband. Thedeadband is defined by the yellow deviation alarm limit. To specify adeadband error algorithm, set the DEADB_ERR input to 1.
Freeze Bias Reset windup occurs in a PID loop when the process variablefails to adjust quickly enough to the desired setpoint, in spite of the steadilyincreasing or decreasing bias of the integral mode. Anti-reset windupprotection protects the integral mode of a PID loop from windup by keepingthe bias from exceeding a specified range.
Two types of reset windup protection are available, depending on the valueyou enter for the BIAS_FREEZE input.
• If you enter 1 for the BIAS_FREEZE input, the anti-reset windupalgorithm stops the integral mode from changing the bias whenever theoutput exceeds the high or low limit.
• If you enter 0 for the BIAS_FREEZE input, the algorithm uses biasbacktracking and computes what the bias needs to be in order to makethe output equal to the high or low output limit.
If you need to limit the output further, you can provide additional anti-resetwindup protection by writing directly to the AWS input (page 3-21).
3-21SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Reset Windup Protection The AWS input defines the anti-reset windupstatus and can have any one of the following values during operation of theloop:
0: The output is within the constraints defined by HLIM (high limit)and LLIM (low limit) inputs.
1: The output is constrained at the low limit; if the loop tries todecrease the output by decreasing the bias, the output does not change.The output and bias may increase.
2: The output is constrained at the high limit; if the loop tries toincrease the output by increasing the bias, the output does not change.The output and bias may decrease.
3: The block is no longer integrating, and the loop does not have acontrol path to the controlled variable. The output may still change ifthe process variable changes and the gain is greater than 0.
If you use external reset windup protection, the AWS input indicates thestatus of the loop. However, you can write a 3 to the AWS input at any timeto freeze the integral mode. Any other value in the AWS input resumes theintegral mode.
Maximum Output The HLIM input is a real number that sets the highlimit for the output. The value must be between 0.0 and 1.0 for a positionalgorithm, where 0.0 = 0% and 1.0 = 100%, and between --1.0 and 1.0 for avelocity algorithm, where --1.0 = --100% and 1.0 = 100%.
Minimum Output The LLIM input is a real number that sets the low limitfor the output. The value must be between 0.0 and 1.0 for a positionalgorithm, where 0.0 = 0% and 1.0 = 100%, and between --1.0 and 1.0 for avelocity algorithm, where --1.0 = --100% and 1.0 = 100%.
Output You can use the OUT input to change the loop output while theloop is in manual mode.
Disable Alarm Monitoring To disable monitoring for the followingalarms, set the corresponding input to zero: high and low alarms (MAL_HL),high high and low low alarms (MAL_HHLL), yellow and orange deviationalarms (MDEV_YO), and rate-of-change alarm (MRCA).
3-22 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
Associated math is provided to expand the capability of the PID blocks. Allmath associated with a PID block must be contained within a separatefunction block. This function block is specified for the PID block in the blockinput ASO_FB. The function block is then called when the PID blockexecutes, based upon the selection of associated math inputs.
If you want to add an associated math operation to a PID block, do thefollowing tasks:
• Create and compile a function block using SCL.
• Place a reference to this object in the symbol table.
• Specify the math block by name or number to the ASO_FB input of thePID block. If you use a name, you must enter it in the symbol table.
• Set the appropriate input (ASO_PV, ASO_AUTO, ASO_CAS, or ASO_OUT)to 1.
In order for the PID block to compile in the CFC, you must provide a valuefor the ASO_FB input. If you do not require associated math in yourapplication, follow these steps:
1. If you are in the overview mode in the CFC chart (if you cannot readthe names of the attributes on the function block), double-click in awhite space near the function block. The CFC is now in page mode.
2. Position the cursor over the ASO_FB attribute and click the right mousebutton.
3. Select Insert Connection to Operand from the menu that appears.
4. Type ASC_PID in the Symbol/Operand field and press Enter.
5. Add the ASC_PID function block in the Blocks folder of your S7program. Do not enable the associated math block if you do not need it;leave all of the ASO_PV, ASO_AUTO, ASO_CAS, and ASO_OUT Booleaninputs false (0).
The associated math block shares the same data block as the PID block. Toaccess the variables of the PID block by name, you must create an instanceof PID within the associated math block.
NOTE: Do not declare any additional variables in your associated mathblock. Doing so results in data being overwritten in the PID block. Useglobally declared data if you require additional variables for yourcalculations.
Associated Math
3-23SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
SCL (Structured Control Language) code for the ASC_PID function block isprovided in the OSx Library for you to copy and modify as needed. SelectFile→Open from the SIMATIC Manager, double-click the S7 Program folder,and double-click the Source folder. Then click the circle next to Libraries, andselect OSx Library from the list. Double-click the ASC_PID block to open it.
The following example shows an associated math block for PID:
//***EXAMPLE***// This is an example block for associating math on PV// update for the PID block. All variables within the// PID instance will be available under the declared// structure APID.
FUNCTION_BLOCK “ASC_PID”;TITLE=’ASC_PID’;AUTHOR: OSxLib;NAME: ASC_PID;FAMILY: CONTROL;VERSION: ’4.11’://KNOW_HOW_PROTECT;
VARAPID:PID; //Declare an instance of PID
END_VAR; //This provides a map into the PID block
// NOTE: Do not declare any additional variables// within this block.
CONST// Associate math identifiers for siFunctionASSOC_PV :=0; // Associate math on PV updateASSOC_AUTO :=1; // Associate math on autoASSOC_CASC :=2; // Associate math on cascadeASSOC_OUT :=3; // Associate math on output
END_CONST;
BEGIN
(* Associated math can be called from any of fourpoints within the PID block. These points are:
During Process variable updateDuring Auto mode calculationsDuring Cascade mode calculationsDuring Output update
3-24 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
This function block (ASC_PID) is called from eachof these points when enabled. The locationthis block is called from is contained in thevariable APID.siFunction. This integer variablecontains a number from 0 to 3. These numbers matchthe constants declared above.
ASSOC_PV :=0; // Associate math on PV updateASSOC_AUTO :=1; // Associate math on autoASSOC_CASC :=2; // Associate math on cascadeASSOC_OUT :=3; // Associate math on output
The APID.siFunction variable must be checkedbefore doing any calculations so that the correctcalculation is done at the correct time:
*)
// Determine which part of the PID called associated math
CASE APID.siFunction OF
ASSOC_PV:// If in manual mode, set output to 40% of PVIF (APID.IMAN = TRUE) THEN
APID.OUT := APID.PV * 0.40;END_IF;
ASSOC_AUTO://Place any operations to be done when PID is//in auto mode here:
;
ASSOC_CASC://Place any operations to be done when PID is//in cascade mode here:
;
ASSOC_OUT://Place any operations to be done on PID output//here:
;
END_CASE;
END_FUNCTION_BLOCK
3-25SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
• Set the ASO_PV input to 1 to execute associated math when the PIDblock executes the PV cycle. Code that you have written under theASSOC_PV section of the associated math block ASC_PID is executed.This math code executes in manual, automatic, and cascade modesbefore the PID calculation is performed. Preprocessing of the processvariable, such as special filtering, occurs in this section.
To modify the loop process variable from within an associated mathblock, manipulate the LPV (loop process variable) output, not the PVinput. The function block loads the PV value into the LPV output beforeexecuting the associated math and uses the LPV output in thecomputations.
This section executes on ALM_PRESET or PID_ST, whichever is less.
• Set the ASO_AUTO input to 1 to execute associated math when the PIDblock is in automatic mode. Code that you have written under theASSOC_AUTO section of the associated math block ASC_PID isexecuted.
To modify the setpoint in the loop, manipulate the LSP (internal loopsetpoint) output, not the SP (setpoint) input. The block loads the SPvalue into the LSP output before executing the associated math anduses the LSP output in the computations.
• Set the ASO_CAS input to 1 to execute associated math when thecontroller is in cascade mode. Code that you have written under theASSOC_CASC section of the associated math block ASC_PID isexecuted.
To modify the setpoint in the loop, manipulate the LSP output, not theRSP (remote setpoint) input. The PID loads the RSP value into the LSPoutput before executing the associated math and uses the LSP output inthe computations.
3-26 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
PID Loop (continued)
• Set the ASO_OUT input to 1 to execute associated math when the PIDblock is in auto or cascade modes after the loop calculation, but beforethe field value of the loop output is updated.
If you want to modify the output after the loop computation, but beforethe field update, manipulate the LMN (internal loop output) output, notthe OUT input. The PID performs the loop calculation and then loadsthe LMN output into the OUT input. For air-to-close on analog output,LMN goes from zero to one for the associated math on output and one tozero after the associated math on output is complete.
Use the internal loop variables, LPV, LSP, and LMN, only within theassociated math for the loop. In all other areas of the Engineering Toolset(FBs, CFCs, SFCs), use the PV input to access the process variable for theloop and the OUT input to access the output; to access the setpoint, use theSP input in automatic mode and the RSP input in cascade mode.
3-27SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
The Boolean outputs IMAN (in manual), IAUTO (in automatic), and ICASC (incascade) indicate the internal state of the loop. These bits do not, however,indicate whether the loop computations have completed initialization.
The SMODE (status mode) output provides information about the loop sta-tus. During loop operation, SMODE can assume any one of the followingseven integer values.
0: The program has just been downloaded into the controller, but thecontroller has not been switched to RUN mode, or the loop has not yetexecuted.
1: The loop has just transitioned into manual mode from eitherautomatic or cascade; or the loop has just transitioned into manualmode and the controller has just switched to RUN mode after aprogram download.
2: The loop is in manual mode and has been in this mode for at leastone operation of the loop calculations, or for two seconds, whichever isless.
3: The loop has just transitioned into automatic mode from eithermanual or cascade, and the SP (setpoint) input and LSP (loop setpoint)output have been initialized to the current value of the processvariable. This makes the loop error equal to zero; the loop output doesnot change to provide a bumpless transfer.
4: The loop is in automatic mode and has been in this mode for atleast one operation of the loop calculations. Normal controlcomputations based on the setpoint and process variable are beingperformed.
5: The loop has just transitioned into cascade mode, and setpointinitialization is complete with a bumpless transfer to the RSP input.
6: The loop is in the remote or cascaded setpoint mode and has beenin this mode for at least one operation of the loop calculations, andnormal loop computations are being performed on the RSP input.
NOTE: Wait until SMODE equals 3, 4, 5, or 6 before you change the loopsetpoint from an SFC step, function block, the debug utility, or OSx;otherwise, the loop may overwrite the value with the process variable. Todetermine loop status, always check the value of the SMODE extension, notthe value of IMAN, IAUTO, or ICASC.
Loop Status
3-28 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
3.3 ONOFF (On/Off)
The ONOFF function block (FB383) is a high-gain proportional control blockthat contains a PID loop. The output from an ONOFF block can be used tochange the state of a device based on PV and deviation alarms.
When you use an ONOFF block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_P (FB394)
• ALARM_8P (SFB35)
• RD_SINFO (SFC6)
• ADAPTER (FB393)
• ASC_ONOF (FB408), or any associated math block that you create
An associated math block must be specified for each ONOFF block. If you donot require associated math, select the place-holding associated math block,ASC_ONOF, and set the values of ASO_PV, ASO_AUTO, and ASO_CASC to 0.
The ONOFF function block is shown in Figure 3-7, and its inputs andoutputs are described in Table 3-3 and Table 3-4.
If you do not use all of the I/O elements in a function block, or if you alwaysuse certain elements the same way, you can set them to the appropriatevalue and then make them invisible. The elements are still present andfunctioning in the block, but they are not visible on the CFC, giving thefunction block a less cluttered appearance. The following inputs on theONOFF function block, for example, are rarely used, and can be madeinvisible to simplify its appearance on the CFC: REV_ACTING, MAL_HL,MAL_HHLL, MDEV_YO, and MRCA. See page 1-14 for the procedure.
An OSx deadband is used to specify the change (in percent of span) in theinput value required for OSx to update the value in the database. Thedeadband is automatically set to a default of 1.0%. You can change thedeadband value in the Comment field of the Operator Control & Monitoringdialog box by entering CHANGE=<n>, where n is the new deadband valuebetween 0.0 and 100.0. Set this deadband value to filter out noise in theinput signal. This value is used only to provide a setting for the OSx system.The ONOFF function block does not use this value for any calculation.
Configure engineering units for the process variable of the ONOFF block inthe Comment field of the Operator Control and Monitoring window. Seepage 1-26.
On/Off Control
Required Blocks
The ONOFF Block
3-29SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
OB351
BO EN
I SP_TYPE
R ONOFF_ST
R SAMPLE_T
FB ASO_FB
BO ASO_PV
BO ASO_AUTO
BO ASO_CAS
onoff_2
ONOFF
ENO BO
MASTER_G BO
IMAN BO
IAUTO BO
ICASC BO
SERR BO
INHHA BO
INHA BO
INLA BO
INLLA BO
INYDA BO
INODA BO
INRCA BO
OVRUN BO
1
0
1.0
0.1
0
0
0
0
On/Off Block
BO NRDY
BO RMAN
BO RATO
0
0
0
SMODE I
ERR R
LPV R
LSP R
DOUT BO
LMN R
BO RCAS0
BO GMAN
BO GAUTO
BO GCASC
0
0
0
R SP0.0
R RSP0.0
R SPH
R SPL
1.0
0.0
0.0 R PV
R ALM_PRES2.0
BO DEVICE_O
BO DEVICE_L
0
0
DEV_RTO BO
BIAS_O R
R PVH1.0
DEV_RTC BO
(Figure continued on next page.)
Figure 3-7 ONOFF Block
3-30 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
ONOFF (continued)
R HA
R LA
R LLA
R ODA
R YDA
R RCA
0.8
0.2
0.1
0.2
0.1
1.0
R KC
R TI
1.0
999.99
R TD0.0
I IOUT0
BO MAL_HL
BO MAL_HHLL
BO MDEV_YO
R BIAS
1
1
1
0.0
BO REV_ACTI0
R ADB0.01
R HHA0.9
R PVL0.0
BO BTA0.0
BO MRCA1
Figure 3-7 ONOFF Block (continued)
3-31SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Table 3-3 Input Table for ONOFF
Element Description Type InitialValue
EN Enable BOOL 1
ASO_FB FB number for associated function block FB 0
ASO_PV Enable associated math on PV cycle BOOL 0
ASO_AUTO Enable associated math during auto mode BOOL 0
ASO_CAS Enable associated math during cascade mode BOOL 0
DEVICE_OUT Lockable device is attached BOOL 0
DEVICE_LOCK Lockable device is locked BOOL 0
RMAN Request manual mode BOOL 0
RATO Request automatic mode BOOL 0
RCAS Request cascade mode BOOL 0
GMAN Go to manual mode BOOL 0
GAUTO Go to automatic mode BOOL 0
GCASC Go to cascade mode BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T * Unit of sample time (in seconds) REAL 0.1
ONOFF_ST ONOFF sample time (in seconds) REAL 1.0
ALM_PRESET Alarm preset time (in seconds) REAL 2.0
SP_TYPE Setpoint type (0 = default, 1 = cascaded, 2 = computed) INT 0
SP Setpoint REAL 0.0
RSP Remote setpoint REAL 0.0
SPH Setpoint high limit REAL 1.0
SPL Setpoint low limit REAL 0.0
PV Process variable REAL 0.0
PVH PV high limit REAL 1.0
PVL PV low limit REAL 0.0
BTA Broken transmitter alarm BOOL 0
ADB Alarm deadband REAL 0.01
* See discussion of SAMPLE_T on page 1-13.
Table continues on next page.
3-32 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
ONOFF (continued)
Table 3-3 Input Table for ONOFF (continued)
Element Description Type InitialValue
HHA High-high alarm limit REAL 0.9
HA High alarm limit REAL 0.8
LA Low alarm limit REAL 0.2
LLA Low-low alarm limit REAL 0.1
ODA Orange deviation limit REAL 0.2
YDA Yellow deviation limit REAL 0.1
RCA Rate-of-change limit REAL 1.0
KC Proportional gain REAL 1.0
TI Reset time (in minutes) REAL 999.99
TD Derivative time (in minutes) REAL 0.0
REV_ACTING 1 = reverse acting, 0 = direct acting BOOL 0
IOUT Integer output INT 0
BIAS PID bias REAL 0.0
MAL_HL Monitor high/low alarms BOOL 1
MAL_HHLL Monitor high-high/low-low alarms BOOL 1
MDEV_YO Monitor yellow/orange deviations BOOL 1
MRCA Monitor rate-of-change alarm BOOL 1
3-33SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Table 3-4 Output Table for ONOFF
Element Description Type InitialValue
ENO Output valid BOOL 0
MASTER_GMAN Output for setting the master to manual BOOL 0
IMAN In manual mode BOOL 0
IAUTO In auto mode BOOL 0
ICASC In cascade mode BOOL 0
SERR Sign error (1 = --, 0 = +) BOOL 0
INHHA Loop in high-high alarm: PV > HHA BOOL 0
INHA Loop in high alarm: PV > HA BOOL 0
INLA Loop in low alarm: PV < LA BOOL 0
INLLA Loop in low-low alarm: PV < LLA BOOL 0
INYDA Loop in yellow deviation alarm: ERR > ABS(YDA) BOOL 0
INODA Loop in orange deviation alarm: ERR > ABS(ODA) BOOL 0
INRCA Loop in rate-of-change alarm BOOL 0
OVRUN Loop overrunning BOOL 0
SMODE Block status INT 0
ERR Loop error REAL 0.0
BIAS_O Loop bias output REAL 0.0
LPV Internal scaled PV input REAL 0.0
LSP Internal scaled SP input REAL 0.0
LMN Internal output REAL 0.0
DOUT Discrete output BOOL 0
DEV_RTO_RTR RTO/RTR input to attached device BOOL 0
DEV_RTC_RTS RTC/RTS input to attached device BOOL 0
3-34 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
ONOFF (continued)
The inputs and outputs for the PID control of the ONOFF block aredescribed in Section 3.2 under “PID Inputs and Outputs,” which begins onpage 3-12. Inputs and outputs specific to the ONOFF block are discussedbelow.
Modes The RMAN, RATO, and RCAS inputs are used to request changes tomanual, automatic, and cascade mode, respectively, for the ONOFF block.The corresponding GMAN, GAUTO, and GCASC inputs can also be used forthis purpose. They are included in the OSx Library for completeness inreplicating APT functionality.
In manual mode, the loop algorithms are not performed, and the controlprogram or operator can manipulate the output directly by writing to theIOUT input.
In automatic mode, the loop within the ONOFF block takes the setpointfrom the SP (setpoint) input. Loop calculations are then performed, and theDOUT output is updated.
In cascade mode, the setpoint is provided by an external source. This sourcecan be the output of another block, a declared real variable, or the outputfrom another PID block. In this case, the RSP input is the remote setpointsource for the loop within the ONOFF block.
ONOFF Inputs andOutputs
3-35SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Device Control In a typical loop operation, a measured process variableis compared to a setpoint, or target value. The difference between these twovalues is the error signal that the controller uses to calculate an output tothe control device. The control device, in turn, manipulates the controlledvariable that serves as an input to the process.
The output from an ONOFF block can be used to control a device using theDEV_RTO_RTR, DEV_RTC_RTS, and DOUT outputs. If the output iscontrolling a device, the block expects the device to be in a locked state.
The input DEVICE_OUT must be set to 1 if it is attached to a lockable device.The input DEVICE_LOCK must be attached to the LOCKD_O output of theattached device (Figure 3-8).
DEVICE_OUT
RTC
LOCKD_O
ONOFF
VDD
DEVICE_LOCK
1
DEV_RTO
DEV_RTCRTO
Figure 3-8 ONOFF Example
3-36 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
ONOFF (continued)
If the absolute value of the loop error is greater than or equal the value ofthe yellow deviation alarm, a discrete output DOUT is manipulated.
• If the controller is direct-acting, the output DOUT is set to true whenthe error exceeds the low yellow deviation. The output remains trueuntil the PV passes through the positive yellow deviation as shown inFigure 3-9.
• If the controller is reverse-acting, the output DOUT is set to true whenthe error exceeds the high yellow deviation. The output remains trueuntil the PV passes through the negative yellow deviation as shown inFigure 3-9.
• The IOUT input manipulates the DOUT output and is read only whenthe block is in auto or cascade and read/write when the block is inmanual. DOUT is true when IOUT = 1, and false when IOUT = 0.
Yellow deviation
Yellow deviation
Orange deviation
Orange deviation
Error
Setpoint
Direct-acting
Reverse-acting
DOUT = true
Yellow deviation
Yellow deviation
Orange deviation
Orange deviation
Error
Setpoint
DOUT = true
Figure 3-9 Direct and Reverse-Acting ONOFF Block
3-37SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Associated math is provided to expand the capability of the ONOFF blocks.All math associated with an ONOFF block must be contained within aseparate function block. This function block is specified for the ONOFFblock in the block input ASO_FB. The function block is then called when theONOFF block executes based upon the selection of associated math inputs.
If you want to add an associated math operation to a ONOFF block, do thefollowing tasks:
• Create and compile a function block using SCL.
• Place a reference to this object in the symbol table.
• Specify the math block by name or number to the ASO_FB input of theONOFF block. If you use a name, you must enter it in the symbol table.
• Set the appropriate input (ASO_PV, ASO_AUTO, or ASO_CAS) to 1.
In order for the ONOFF block to compile in the CFC, you must provide avalue for the ASO_FB input. If you do not require associated math in yourapplication, follow these steps:
1. If you are in the overview mode in the CFC chart (if you cannot readthe names of the attributes on the function block), double-click in awhite space near the function block. The CFC is now in page mode.
2. Position the cursor over the ASO_FB attribute and click the right mousebutton.
3. Select Insert Connection to Operand from the menu that appears.
4. Type ASC_ONOF in the Symbol/Operand field and press Enter.
5. Add the ASC_ONOF function block in the Blocks folder of your S7program. Do not enable the associated math block if you do not need it;leave all of the ASO_PV, ASO_AUTO, ASO_CAS, and ASO_OUT Booleaninputs false (0).
The associated math block shares the same data block as the ONOFF block.To access the variables of the ONOFF block by name, you must create aninstance of ONOFF within the associated math block.
NOTE: Do not declare any additional variables in your associated mathblock. Doing so results in data being overwritten in the ONOFF block. Useglobally declared data if you require additional variables for yourcalculations.
Associated Math
3-38 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
ONOFF (continued)
SCL code for the ASC_ONOF function block is provided in the OSx Libraryfor you to copy and modify as needed. Select File-->Open from the SIMATICManager, double-click the S7 Program folder, and double-click the Sourcefolder. Then click the circle next to Libraries, and select OSx Library from thelist. Double-click on the ASC_ONOF block to open it.
The following example shows an associated math block for ONOFF:
//***EXAMPLE***// This is an example block for associating math on PV// update for the ONOFF block. All variables within the// ONOFF instance will be available under the declared// structure AONOFF.
FUNCTION_BLOCK “ASC_ONOF”;TITLE=’ASC_ONOF’;AUTHOR: OSxLib;NAME: ASC_ONOF;FAMILY: CONTROL;VERSION: ’4.11’://KNOW_HOW_PROTECT;
VARAONOFF:ONOFF; //Declare an instance of ONOFF
END_VAR; //This provides a map into the ONOFF block
// NOTE: Do not declare any additional variables// within this block.
CONST// Associate math identifiers for siFunctionASSOC_PV :=0; // Associate math on PV updateASSOC_AUTO :=1; // Associate math on autoASSOC_CASC :=2; // Associate math on cascade
END_CONST;
BEGIN
(* Associated math can be called from any of threepoints within the ONOFF block. These points are:
During Process variable updateDuring Auto mode calculationsDuring Cascade mode calculations
3-39SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
This function block (ASC_ONOF) is called from eachof these points when enabled. The locationthis block is called from is contained in thevariable AONOFF.siFunction. This integer variablecontains a number from 0 to 2. These numbers matchthe constants declared above.
ASSOC_PV :=0; // Associate math on PV updateASSOC_AUTO :=1; // Associate math on autoASSOC_CASC :=2; // Associate math on cascade
The AONOFF.siFunction variable must be checkedbefore doing any calculations so that the correctcalculation is done at the correct time:
*)
// Determine which part of the ONOFF called associated math
CASE AONOFF.siFunction OF
ASSOC_PV:// If in manual mode, attempt to keep the PV// between low and high alarm limitsIF (AONOFF.IMAN = TRUE) THEN
IF (AONOFF.INHA = TRUE) THENAONOFF.IOUT := 0;
ELSIF (AONOFF.INLA = TRUE) THENAONOFF.IOUT := 1;
ENDIF;END_IF;
ASSOC_AUTO://Place any operations to be done when ONOFF is//in auto mode here:
;ASSOC_CASC:
//Place any operations to be done when ONOFF is//in cascade mode here:
;
END_CASE;
END_FUNCTION_BLOCK
3-40 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
ONOFF (continued)
• Set the ASO_PV input to 1 to execute associated math when theONOFF block executes the PV cycle. Code that you have written underthe ASSOC_PV section of the associated math block ASC_ONOF isexecuted. This math code executes in manual, automatic, and cascademodes before the PID calculation is performed. Preprocessing of theprocess variable, such as special filtering, occurs in this section.
To modify the loop process variable from within an associated mathblock, manipulate the LPV (loop process variable) output, not the PVinput. The function block loads the PV value into the LPV output beforeexecuting the associated math and uses the LPV output in thecomputations.
This section executes on ALM_PRESET or ONOFF_ST, whichever is less.
• Set the ASO_AUTO input to 1 to execute associated math when theONOFF block is in automatic mode. Code that you have written underthe ASSOC_AUTO section of the associated math block ASC_ONOF isexecuted.
To modify the setpoint in the loop, manipulate the LSP (internal loopsetpoint) output, not the SP (setpoint) input. The block loads the SPvalue into the LSP output before executing the associated math anduses the LSP output in the computations.
• Set the ASO_CAS input to 1 to execute associated math when thecontroller is in cascade mode. Code that you have written under theASSOC_CASC section of the associated math block ASC_ONOF isexecuted.
To modify the setpoint in the loop, manipulate the LSP output, not theRSP (remote setpoint) input. The block loads the RSP value into the LSPoutput before executing the associated math and uses the LSP output inthe computations.
3-41SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
3.4 ALRM (Analog Alarm)
You can use the ALRM function block (FB384) to monitor a process variable,but not to control it. (The analog alarm block does not have a control output,nor does it have tuning parameters.) If you select an analog alarm, you canuse the high/low alarm capability; you can also configure a setpoint and usethe orange and yellow deviations from the setpoint as alarms.
When you use an ALRM function block, the following function blocks mustalso be present in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_P (FB394)
• ALARM_8P (SFB35)
• RD_SINFO (SFC6)
• ADAPTER (FB393)
• ASC_ALRM (FB396), or any associated math block that you create
An associated math block must be specified for each ALRM block. If you donot require associated math, select the place-holding associated math block,ASC_ALRM, and set the value of ASO_PVSP to 0.
The ALRM function block is shown in Figure 3-10, and its inputs andoutputs are described in Table 3-5 and Table 3-6.
If you do not use all of the I/O elements in a function block, or if you alwaysuse certain elements the same way, you can set them to the appropriatevalue and then make them invisible. The elements are still present andfunctioning in the block, but they are not visible on the CFC, giving thefunction block a less cluttered appearance. The following inputs on theALRM function block, for example, are rarely used, and can be madeinvisible to simplify its appearance on the CFC: MAL_HL, MAL_HHLL,MDEV_YO, and MRCA. See page 1-14 for the procedure.
Overview
Required Blocks
The ALRM Block
3-42 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
ALRM (continued)
An OSx deadband is used to specify the change (in percent of span) in theinput value required for OSx to update the value in the database. Thedeadband is automatically set to a default of 1.0%. You can change thedeadband value in the Comment field of the Operator Control & Monitoringdialog box by entering CHANGE=<n>, where n is the new deadband valuebetween 0.0 and 100.0. Set this deadband value to filter out noise in theinput signal. This value is used only to provide a setting for the OSx system.The ALRM function block does not use this value for any calculation.
Configure engineering units for the process variable of the ALRM block inthe Comment field of the Operator Control and Monitoring window. Seepage 1-26.
OB351
BO EN
BO ASO_PVSP
BO NRDY
BO REN
BO RDIS
R SAMPLE_T
R PV
R ALRM_ST
FB ASO_FB
ai_3
ALRM
ENO BO
DSABL BO
INHHA BO
INHA BO
INLA BO
INLLA BO
INYDA BO
INODA BO
INRCA BO
OVRUN BO
1
0
0
0
0
0
0.1
1.0
0.0
1.0
0.0
0.0
Analog Alarm
SMODE I
ERR R
APV R
ASP R
BO ENABL
R SP
R SPH
R SPL
0
R PVH
R PVL
1.0
0.0
(Figure continued on next page.)
Figure 3-10 ALRM Block
3-43SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
1.0
1
1
1
R RCA
BO MAL_HL
BO MAL_HHLL
BO MDEV_YO
BO MRCA1
0.2
0.1
R ODA
R YDA
R HHA
0
0.1 R ADB
0.9
BO BTA
R HA0.8
0.2
0.1
R LA
R LLA
Figure 3-10 ALRM Block (continued)
3-44 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
ALRM (continued)
Table 3-5 Input Table for ALRM
Element Description Type InitialValue
EN Enable BOOL 1
ASO_FB FB number of associated math block FB 0
ASO_PVSP Associate user math block BOOL 0
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T * Unit of sample time (in seconds) REAL 0.1
ALRM_ST Alarm sample time (in seconds) REAL 1.0
SP Setpoint REAL 0.0
SPH Setpoint high limit REAL 1.0
SPL Setpoint low limit REAL 0.0
PV Process variable REAL 0.0
PVH PV high limit REAL 1.0
PVL PV low limit REAL 0.0
BTA Broken transmitter alarm BOOL 0
ADB Alarm deadband REAL 0.1
HHA High-high alarm limit REAL 0.9
HA High alarm limit REAL 0.8
LA Low alarm limit REAL 0.2
LLA Low-low alarm limit REAL 0.1
ODA Orange deviation limit REAL 0.2
YDA Yellow deviation limit REAL 0.1
RCA Rate-of-change limit REAL 1.0
MAL_HL Monitor high and low alarms BOOL 1
MAL_HHLL Monitor high-high/low-low alarms BOOL 1
MDEV_YO Monitor yellow/orange deviations BOOL 1
MRCA Monitor rate-of-change alarm BOOL 1
* See discussion of SAMPLE_T on page 1-13.
3-45SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
Table 3-6 Output Table for ALRM
Element Description Type InitialValue
ENO Output valid BOOL 0
DSABL Disabled BOOL 0
INHHA Alarm block in high-high alarm: PV > HHA BOOL 0
INHA Alarm block in high alarm: PV > HA BOOL 0
INLA Alarm block in low alarm: PV < LA BOOL 0
INLLA Alarm block in low-low alarm: PV < LLA BOOL 0
INYDA Alarm block in yellow deviation alarm: ERR > ABS(YDA) BOOL 0
INODA Alarm block in orange deviation alarm: ERR > ABS(ODA) BOOL 0
INRCA Alarm block in rate-of-change alarm BOOL 0
OVRUN Alarm block overrunning BOOL 0
SMODE Block status INT 0
ERR Alarm block error REAL 0.0
APV Internal scaled PV input REAL 0.0
ASP Internal scaled SP input REAL 0.0
The alarm inputs and outputs are described in Section 3.2 under “PIDInputs and Outputs,” which begins on page 3-12. Inputs and outputsspecific to the ALRM block are discussed below.
Sample Time The SAMPLE_T and ALRM_ST inputs determine thefrequency of execution of the block. The alarm OVRUN output becomes truewhen the alarm block cannot execute as quickly as you specified in theALRM_ST time. This situation can occur if you set the ALRM_ST to a valuesmaller than the SAMPLE_T. See page 1-13 for more information.
Block Status The current status of the the ALRM block is written to theoutput SMODE. When SMODE is 0, the deviation alarms are not executing;when SMODE is 1, the deviation alarms are executing.
Process Variable and Sepoint The internal representation of the scaledprocess variable is written to the APV output. The internal representation ofthe setpoint is written to the ASP output. You can use these outputs tomanipulate the process variable and the setpoint in associated math.
ALRM Inputs andOutputs
3-46 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
ALRM (continued)
All math associated with an ALRM block must be contained within aseparate function block. This function block is specified for the ALRM blockin the block input ASO_FB. The function block is then called from the ALRMblock during the alarm update.
If you want to add an associated math operation to an ALRM block, do thefollowing tasks:
• Create and compile a function block using SCL.
• Place a reference to this object in the symbol table.
• Specify the math block by name or number to the ASO_FB input of theALRM block. If you use a name, you must enter it in the symbol table.
• Set the ASO_PVSP input to 1.
In order for the ALRM block to compile in the CFC, you must provide avalue for the ASO_FB input. If you do not require associated math in yourapplication, follow these steps:
1. If you are in the overview mode in the CFC chart (if you cannot readthe names of the attributes on the function block), double-click in awhite space near the function block. The CFC is now in page mode.
2. Position the cursor over the ASO_FB attribute and click the right mousebutton.
3. Select Insert Connection to Operand from the menu that appears.
4. Type ASC_ALRM in the Symbol/Operand field and press Enter.
5. Add the ASC_ALRM function block in the Blocks folder of your S7program. Do not enable the associated math block if you do not need it;leave the ASO_PVSP Boolean input false (0).
The associated math block shares the same data block as the ALRM block.To access the variables of the ALRM block by name, you must create aninstance of ALRM within the associated math block.
NOTE: Do not declare any additional variables in your associated mathblock. Doing so results in data being overwritten in the ALRM block. Useglobally declared data if you require additional variables for yourcalculations.
Associated Math
3-47SIMATIC PCS 7 OSx 4.1.2 Library Standard Control Blocks
SCL code for the ASC_ALRM function block is provided in the OSx Libraryfor you to copy and modify as needed. Select File-->Open from the SIMATICManager, double-click the S7 Program folder, and double-click the Sourcefolder. Then click the circle next to Libraries, and select OSx Library from thelist. Double-click on the ASC_ALRM block to open it.
The following example shows an associated math block for ALRM:
//***EXAMPLE***// This is an example block for associating math on PV// update for the alarm block. All variables within the// ALRM instance will be available under the declared// structure ALARM.
FUNCTION_BLOCK “ASC_ALRM”;
TITLE=’ASC_ALRM’;
AUTHOR: OSxLib;NAME: ASC_ALRM;FAMILY: CONTROL;VERSION: ’4.11’://KNOW_HOW_PROTECT;
VARALARM:ALRM; // Declare an instance of ALRM.
// This gives a mapping into the ALRM// instance.
END_VAR;
// NOTE: Do not declare any additional variables// within this block.
BEGIN
// When ALARM is disabled, the setpoint (SP) should// be set to the process variable (PV) minus the// deadband (ADB).
IF(ALARM.SMODE=0) THENALARM.SP := ALARM.PV - ALARM.ADB;
ENDIF;
END_FUNCTION_BLOCK
3-48 SIMATIC PCS 7 OSx 4.1.2 LibraryStandard Control Blocks
4-1SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
Chapter 4
Dynamic Control
4.1 Understanding Dynamic Blocks 4-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 FOLAG (First Order Lag) 4-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3 FOLL (First Order Lead Lag) 4-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 SOLAG (Second Order Lag) 4-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5 SOLL (Second Order Lead Lag) 4-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6 DTD (Dead Time Delay) 4-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.7 DERV (Derivative) 4-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.8 INTEG (Integrator) 4-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
4.1 Understanding Dynamic Blocks
The OSx Library dynamic blocks provide a means to create simulations andto build models for complex control strategies. The OSx Library providesthree basic types of dynamic blocks:
• The simulation blocks allow you to add dynamic characteristics to theprocess and include first and second order lag blocks, first and secondorder lead lag blocks, and a dead time compensator.
• The derivative block simply computes the rate of change of the input.To determine this rate, the block computes the change in the input fromthe last sample time and then divides this change value by the sampletime.
• The integrator block produces an output that is proportional to theintegral of the input (or the sum of the inputs) with respect to thesample time.
For all dynamic control blocks, you must specify a sample time thatdetermines how often the block executes. This sample time is a real numberbetween 0.001 and 3.4x1038 seconds. See page 1-13 for a discussion ofsample time (SAMPLE_T).
These function blocks must be activated with an assignment statement thatsets the ENABL input to true. These blocks can also be enabled from anassignment statement in an SFC step.
To deactivate the block set the ENABL input to false or the RDIS input totrue.
These dynamic blocks have a Boolean input NRDY that you can use tointerlock the execution of the block to some external conditions.
• If you set the NRDY input to true, the block is forced to the disabledstate.
• To return the block to the enabled state you must not only set the NRDYinput to false, but you must also re-enable the block with anassignment statement.
The ENABL input for the dynamic blocks maps to a DO tag in OSx. You canuse this input to enable or disable the block in OSx. To command the blockfrom a DDO in OSx, you enter 0x8000 in the Command field to enable theblock and 0x0000 to disable.
Overview
Enabling andDisabling Blocks
4-3SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
Two types of initialization are available with the simulation blocks. Forwardinitialization allows straight simulations; backward initialization supportsmodel base control where the actual process variable defines the initialvalue of the output. No initialization of the output or input is done for thederivative block.
The upper section of Figure 4-1 illustrates forward initialization, whichoperates as follows:
• The output is set to the value that you specify as the initial outputOUTIC; this value serves as a bias that is added to an internal variablein the simulation block.
• The current input value is stored internally as INIC in the block as theinitial input. Changes in the output are then computed relative tochanges in the difference between the new, current input and the valuestored as the initial input.
The bottom part of Figure 4-1 shows backward initialization, which operatesas follows:
• The current value of the output from the block is stored as the initialoutput OUTIC.
• The expected value of the input is computed by dividing the output bythe steady-state gain. The expected input is moved to the block inputand is also stored internally as the initial input INIC. For the integratorblock, the current value of the input is stored internally in the block asthe initial input INIC.
Initialization
4-4 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
Understanding Dynamic Blocks (continued)
+
+
+
--
IN
INIC OUTIC
OUT
a: Forward Initialization
b: Backward Initialization
--
+
--
+
OUTICGAIN
OUTIC
OUT
OUTICGAIN
Gain
Gain
Figure 4-1 Forward and Backward Initialization
All simulation calculations are relative to the difference between the inputand the INIC input. This means that after an initialization, either the inputor the INIC must change before the output can start to change.
Following either forward or backward initialization, a delay table isinitialized so that the output does not respond to changes in the input forthe time specified by the ratio of dead time to sample time.
NOTE: The dynamic block does not update the output until the secondsample time following initialization.
4-5SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
Following initialization, the first and second order lags and first and secondorder lead lags function as follows.
• Each sample time after the first scan, the block updates the delay tableusing the following simulation formula:
Table entry= B1 × (input − initial input) + B2 × (last input − initial input) −[A1 × (table entry − 1) + A2 × (table entry − 2)] + initial output
The values of B1, B2, A1, and A2 depend on the type of simulationblock (first order lag, second order lag, etc.) and the steady-state gain.
• The next output from the simulation block is determined by the tableentry computed n samples ago where n is the ratio of delay time tosample time.
NOTE: The ratio of dead time to sample time should not exceed 62. Thedead time table that simulates the delay has a length of 62 entries.
The delayed output of the block is always available as the OUT output. Theintermediate output without the delay is available as the DMOUT output.
If you choose a first or second order lag, or a first or second order lead lag,OSx dynamic blocks provide three inputs that you can use to control theresponse to the change in input. These inputs are TAU1, TAU2, and TLEAD.
• If you choose a first order lag, TAU1 contains the value that you enteras the first time constant; the system initializes TAU2, and TLEAD to 0.
• If you choose a second order lag, TAU1 and TAU2 contain the values thatyou enter as the first and second time constants; the system initializesTLEAD to 0.
• If you choose a first-order lead lag, TAU1 and TLEAD contain the valuesthat you enter as the lag time and lead time; the system initializesTAU2 to 0.
• If you choose a second-order lead lag, TAU1, TAU2, and TLEAD containthe values that you enter as the first and second time constants and thelead time.
NOTE: Before you change the input or use the output of a dynamic block,check the status of the ENABLD extension to verify that the value is true.
SimulationEquations
4-6 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
4.2 FOLAG (First Order Lag)
The FOLAG (first order lag) function block (FB423) simulates a dynamicprocess in which a specified first order time constant determines therelationship between an immediate change in the input and a gradualcorresponding change in the output.
Figure 4-2 shows the formula that is used for a first order lag block.
deadtime
input outputgain * e−θs
τ s+ 1
input
output
gain =∆ output∆ input
∆ input
∆ output
τ
63.2%
Figure 4-2 First Order Lag
• Gain specifies the ratio of the change in output to the change in inputat a steady state.
• τ specifies the time in seconds required to reach 63.2 percent of thefinal output after a change in the input. It is the time constant.
• θ is the dead time in seconds.
• s is the LaPlace operator.
When you use a FOLAG block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
4-7SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
The FOLAG function block is shown in Figure 4-3, and its inputs andoutputs are described in Table 4-1 and Table 4-2.
1
0.1
1.0
Lag3
FOLAGFirst order lag OB35
1
ENO BOBO EN
BO NRDY
R FOLAG_ST
0
0
ENABLD BO
OUT R
0.0
0
0
BO ENABL
BO REN
BO RDIS
R SAMPLE_T
R IN
10.0
0.0
R GAIN
R DTIME
1.0
0.0
1
0.0 R OUTIC
R INIC
R TLAG
BO INIT_TYP
DMOUT R
Figure 4-3 FOLAG Block
The FOLAG Block
4-8 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
FOLAG (First Order Lag) (continued)
Table 4-1 Input Table for FOLAG
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Block enable BOOL 0
NRDY Block not ready BOOL 0
SAMPLE_T Unit of sample time (in seconds) REAL 0.1
FOLAG_ST Block sample time (in seconds) REAL 1.0
IN Input value REAL 0.0
INIC Initial input REAL 0.0
OUTIC Initial output REAL 0.0
GAIN Steady state gain REAL 1.0
TLAG Lag time constant (in seconds) REAL 10.0
DTIME Dead time (in seconds) REAL 0.0
INIT_TYP Initialization type (1=forward, 0=backward) BOOL 1
Table 4-2 Output Table for FOLAG
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Block is enabled BOOL 0
OUT Output variable REAL 0.0
DMOUT Output without dead time REAL 0.0
4-9SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
4.3 FOLL (First Order Lead Lag)
The FOLL (first order lead lag) function block (FB424) simulates a dynamicprocess in which specified time constants determine both lead and lag times.
The output depends on the ratio of lead to lag as explained below. Assumethe following values in each example:
∆ input = 1.0 gain = 1.0
• If TLead / TLag is greater than 1.0, then the initial responseovershoots the steady-state output value.
Initial output= ∆input * Gain TLeadTLag = 1.0 * 1.0 2.0
1.0 = 2.0
2.0
n = 1 2 3
Yn
0
steady---state output = 1.0
4
• If TLead / TLag is less than 1.0, then the initial response undershootsthe steady-state output value.
Initial output= ∆input * Gain TLeadTLag = 1.0 * 1.0 1.02.0 = 0.5
0.5
n = 1 2 3
Yn
0
steady---state output = 1.0
4
• If TLead / TLag is equal to 1.0, then the initial responseinstantaneously reaches the steady-state output value.
Initial output= ∆input * Gain TLeadTLag = 1.0 * 1.0 1.0
1.0 = 1.0
n = 1 2 3
Yn
0
steady---state output = 1.0
4
Overview
4-10 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
FOLL (First Order Lead Lag) (continued)
Figure 4-4 shows the formula that is used for a first order lead lag block.
input outputgain(τ3 s+ 1)e−θs
τ1 s+ 1
Figure 4-4 First Order Lead Lag
• Gain specifies the ratio of the change in output to the change in inputat a steady state.
• τ1 specifies a time in seconds that is associated with the response tochange in the input that causes 63.2% of the change in output. It iscalled the lag time constant.
• τ3 specifies a time in seconds that is associated with the lead responseafter a change in the input. It is called the lead time constant.
• θ is the dead time in seconds.
• s is the LaPlace operator.
When you use a FOLL block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Required Blocks
4-11SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
The FOLL function block is shown in Figure 4-5, and its inputs and outputsare described in Table 4-3 and Table 4-4.
1
0.1
1.0
Lead1
FOLLFirst order lead lag OB35
1
ENO BOBO EN
BO NRDY
R FOLL_ST
0
0
ENABLD BO
OUT R
0.0
0
0
BO ENABL
BO REN
BO RDIS
R SAMPLE_T
R IN
10.0
0.0
R GAIN
R DTIME
1.0
0.0
1
0.0 R OUTIC
R INIC
R TLAG
BO INIT_TYP
DMOUT R
10.0 R TLEAD
Figure 4-5 FOLL Block
The FOLL Block
4-12 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
FOLL (First Order Lead Lag) (continued)
Table 4-3 Input Table for FOLL
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable block BOOL 0
NRDY Block not ready BOOL 0
SAMPLE_T Unit of sample time (in seconds) REAL 0.1
FOLL_ST Block sample time (in seconds) REAL 1.0
IN Input value REAL 0.0
INIC Initial input REAL 0.0
OUTIC Initial output REAL 0.0
GAIN Steady state gain REAL 1.0
TLAG Lag time constant (in seconds) REAL 10.0
TLEAD Lead time constant (in seconds) REAL 10.0
DTIME Dead time (in seconds) REAL 0.0
INIT_TYP Initialization type (1=forward, 0=backward) BOOL 1
Table 4-4 Output Table for FOLL
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Block is enabled BOOL 0
OUT Output value REAL 0.0
DMOUT Output without dead time REAL 0.0
4-13SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
4.4 SOLAG (Second Order Lag)
The SOLAG (second order lag ) function block (FB425) simulates a dynamicprocess in which specified time constants determine the relationshipbetween an immediate change in the input and a gradual correspondingchange in the output.
Figure 4-6 shows the formula that is used for a second order lag block.
input outputgain * e−θs
(τ1 s+ 1)(τ2 s+ 1)
input
output
deadtimegain =
∆ output∆ input
∆ input
∆ output
Figure 4-6 Second Order Lag
• Gain specifies the ratio of the change in output to the change in inputat a steady state.
• τ1 and τ2 determine the characteristic “S” shape of the output responseto a change in input. τ1 and τ2 are the first order time constant and thesecond order time constant, respectively.
• θ is the dead time in seconds.
• s is the LaPlace operator.
When you use a SOLAG block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
4-14 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
SOLAG (Second Order Lag) (continued)
The SOLAG function block is shown in Figure 4-7, and its inputs andoutputs are described in Table 4-5 and Table 4-6.
1
0.1
1.0
Lag4
SOLAGSecond order lag OB35
1
ENO BOBO EN
BO NRDY
R SOLAG_ST
0
0
ENABLD BO
OUT R
0.0
0
0
BO ENABL
BO REN
BO RDIS
R SAMPLE_T
R IN
10.0
0.0
R GAIN
R DTIME
1.0
0.0
1
0.0 R OUTIC
R INIC
R TAU1
BO INIT_TYP
DMOUT R
10.0 R TAU2
Figure 4-7 SOLAG Block
The SOLAG Block
4-15SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
Table 4-5 Input Table for SOLAG
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable block BOOL 0
NRDY Block not ready BOOL 0
SAMPLE_T Unit of sample time (in seconds) REAL 0.1
SOLAG_ST Block sample time (in seconds) REAL 1.0
IN Input value REAL 0.0
INIC Initial input REAL 0.0
OUTIC Initial output REAL 0.0
GAIN Steady state gain REAL 1.0
TAU1 Lag time constant 1 (in seconds) REAL 10.0
TAU2 Lag time constant 2 (in seconds) REAL 10.0
DTIME Dead time (in seconds) REAL 0.0
INIT_TYP Initialization type (1=forward, 0=backward) BOOL 1
Table 4-6 Output Table for SOLAG
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Block is enabled BOOL 0
OUT Output value REAL 0.0
DMOUT Output without dead time REAL 0.0
4-16 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
4.5 SOLL (Second Order Lead Lag)
The SOLL (second order lead lag) function block (FB426) simulates adynamic process in which specified constants determine the relationshipbetween an immediate change in the input and a gradual, correspondingchange in the output.
Figure 4-8 shows the formula that is used for a second order lead lag block.
input outputgain(τ3 s + 1)e−θs
(τ1 s+ 1)(τ2 s+ 1)
input
output
deadtimegain =
∆ output∆ input
∆ input
∆ output
Figure 4-8 Second Order Lead Lag
• Gain specifies the ratio of the change in output to the change in inputat a steady state.
• τ1, τ2, and τ3 determine the characteristic “S” shape of the outputresponse to a change in input. τ1, τ2, and τ3 are the first order timeconstant, the second order time constant and the lead time constant,respectively.
• θ is the dead time in seconds.
• s is the LaPlace operator.
When you use a SOLL block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
4-17SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
The SOLL function block is shown in Figure 4-9, and its inputs and outputsare described in Table 4-7 and Table 4-8.
1
0.1
1.0
Lead2
SOLLSecond order lead lag OB35
1
ENO BOBO EN
BO NRDY
R SOLL_ST
0
0
ENABLD BO
OUT R
0.0
0
0
BO ENABL
BO REN
BO RDIS
R SAMPLE_T
R IN
10.0
10.0
R GAIN
R TAU2
1.0
0.0
5.0
0.0 R OUTIC
R INIC
R TAU1
DMOUT R
0.0 R DTIME
1 BO INIT_TYP
R TLEAD
Figure 4-9 SOLL Block
The SOLL Block
4-18 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
SOLL (Second Order Lead Lag) (continued)
Table 4-7 Input Table for SOLL
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable block BOOL 0
NRDY Block not ready BOOL 0
SAMPLE_T Unit of sample time (in seconds) REAL 0.1
SOLL_ST Block sample time (in seconds) REAL 1.0
IN Input value REAL 0.0
INIC Initial input REAL 0.0
OUTIC Initial output REAL 0.0
GAIN Steady state gain REAL 1.0
TLEAD Lead time constant (in seconds) REAL 10.0
TAU1 Lag time constant 1 (in seconds) REAL 10.0
TAU2 Lag time constant 2 (in seconds) REAL 5.0
DTIME Dead time (in seconds) REAL 0.0
INIT_TYP Initialization type (1=forward, 0=backward) BOOL 1
Table 4-8 Output Table for SOLL
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Block is enabled BOOL 0
OUT Output value REAL 0.0
DMOUT Output without dead time REAL 0.0
4-19SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
4.6 DTD (Dead Time Delay)
The DTD function block (FB420) simulates a dynamic process with aspecified time delay between a change in the input and a correspondingchange in the output. This block operates like the other dynamic blocksexcept for the update equation:
table_entry = input * gain
Figure 4-10 shows the formula that is used for a DTD block.
input
output
deadtime
input outputgain e−θs
∆ input
∆ output
Figure 4-10 Dead Time Delay Form
• Gain specifies the ratio of the change in output to the change in inputat a steady state.
• Dead time is the interval between the input change and the start of theresponse.
• θ is the dead time in seconds.
• s is the LaPlace operator.
When you use a DTD block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
4-20 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
DTD (Dead Time Delay) (continued)
The DTD function block is shown in Figure 4-11, and its inputs and outputsare described in Table 4-9 and Table 4-10.
1
0.1
1.0
Dtime1
DTDDead time delay OB35
1
ENO BOBO EN
BO NRDY
R DTD_ST
0
0
ENABLD BO
OUT R
0.0
0
0
BO ENABL
BO REN
BO RDIS
R SAMPLE_T
R IN
0.0
R GAIN
R DTIME
1.0
0.0
1
0.0 R OUTIC
R INIC
BO INIT_TYP
DMOUT R
Figure 4-11 DTD Block
The DTD Block
4-21SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
Table 4-9 Input Table for DTD
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable block BOOL 0
NRDY Block not ready BOOL 0
SAMPLE_T Unit of sample time (in seconds) REAL 0.1
DTD_ST Block sample time (in seconds) REAL 1.0
IN Input value REAL 0.0
INIC Initial input REAL 0.0
OUTIC Initial output REAL 0.0
GAIN Steady state gain REAL 1.0
DTIME Dead time (in seconds) REAL 0.0
INIT_TYP Initialization type (1=forward, 0=backward) BOOL 1
Table 4-10 Output Table for DTD
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Block is enabled BOOL 0
OUT Output value REAL 0.0
DMOUT Output without dead time REAL 0.0
4-22 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
4.7 DERV (Derivative)
The DERV function block (FB421) computes the rate of change in the inputby using the following formula:
Rate of change=∆ inputsample time
Figure 4-12 shows the formula that you use to define a derivative block. Theresult of this calculation is placed in the OUT output of the derivative block.
input outputinput (tj) − input (tj−1)
st
output
input
Figure 4-12 Derivative
You can use the DERV block to calculate the rate of change of a variable IN.You can set a flag if the rate of change exceeds a predetermined limit.
To monitor the rate of change of a variable IN, follow these steps:
1. Enable the block and wait for the ENABLD output to become true (1).
2. Monitor the rate of change of a certain variable as the output OUT ofthe DERV block.
3. If the rate of change becomes too great, set a flag that identifies thecondition.
When you use a DERV block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
4-23SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
The DERV function block is shown in Figure 4-13, and its inputs andoutputs are described in Table 4-11 and Table 4-12.
1
0.1
1.0
Deriv4
DERVDerivative OB35
1
ENO BOBO EN
BO NRDY
R DERV_ST
0
0
ENABLD BO
OUT R
0.0
0
0
BO ENABL
BO REN
BO RDIS
R SAMPLE_T
R IN
Figure 4-13 DERV Block
The DERV Block
4-24 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
DERV (Derivative) (continued)
Table 4-11 Input Table for DERV
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable block BOOL 0
NRDY Block not ready BOOL 0
SAMPLE_T Unit of sample time (in seconds) REAL 0.1
DERV_ST Block sample time (in seconds) REAL 1.0
IN Input value REAL 0.0
Table 4-12 Output Table for DERV
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Block is enabled BOOL 0
OUT Output value REAL 0.0
4-25SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
4.8 INTEG (Integrator)
The INTEG function block (FB422) produces an output that is proportionalto the integral of the input (or the sum of the inputs) with respect to thesample time.
The INTEG block uses the following formula to update the delay table:
table entry = (table entry1 ) +1.0
steady---state gain* (input --- initial input) * sample time
The steady-state gain controls the rate of change of the output. A large gainproduces a slow integrator; a small gain produces a fast integrator.
Figure 4-14 shows the formula that is used for an integrator block.
input
output
delayor deadtime
input outpute−θsgain * s
∆ input
line slope = 1τ *
∆ inputsample time
Figure 4-14 Integrator
The integrator block can be used to perform a totalization function if thesteady-state gain GAIN is set to 1.0. To totalize an input, follow these steps:
1. Enable the block and wait for the ENABLD output to become true (1).
2. Open the valve that controls the flow.
The integrator then changes the output OUT based on the change of thecurrent input IN from the initial input INIC.
To reset the INTEG block, follow these steps:
1. Disable the block and wait for the ENABLD output to become false (0).
2. Enable the block and wait for the ENABLD output to become true (1).
3. Set the input INIC to 0.0.
Overview
4-26 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
INTEG (Integrator) (continued)
When you use a INTEG block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
The INTEG function block is shown in Figure 4-15, and its inputs andoutputs are described in Table 4-13 and Table 4-14.
1
0.1
1.0
Integ1
INTEGIntegrator OB35
1
ENO BOBO EN
BO NRDY
R INTEG_ST
0
0
ENABLD BO
OUT R
0.0
0
0
BO ENABL
BO REN
BO RDIS
R SAMPLE_T
R IN
0.0
R GAIN
R DTIME
1.0
0.0
1
0.0 R OUTIC
R INIC
BO INIT_TYP
DMOUT R
Figure 4-15 INTEG Block
Required Blocks
The INTEG Block
4-27SIMATIC PCS 7 OSx 4.1.2 Library Dynamic Control
Table 4-13 Input Table for INTEG
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable block BOOL 0
NRDY Block not ready BOOL 0
SAMPLE_T Unit of sample time (in seconds) REAL 0.1
INTEG_ST Block sample time (in seconds) REAL 1.0
IN Input value REAL 0.0
INIC Initial input REAL 0.0
OUTIC Initial output REAL 0.0
GAIN Steady state gain REAL 1.0
DTIME Dead time (in seconds) REAL 0.0
INIT_TYP Initialization type (1=forward, 0=backward) BOOL 1
Table 4-14 Output Table for INTEG
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Block is enabled BOOL 0
OUT Output value REAL 0.0
DMOUT Output without dead time REAL 0.0
4-28 SIMATIC PCS 7 OSx 4.1.2 LibraryDynamic Control
5-1SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
Chapter 5
Advanced Control Blocks
5.1 Understanding Advanced Control Blocks 5-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 DTC (Dead Time Compensator) 5-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 DMD (Dual Mode) 5-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4 FFOA (Feedforward Output Adjust) 5-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5 FFSA (Feedforward Setpoint Adjust) 5-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6 RATIO (Ratio Station) 5-35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-2 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
5.1 Understanding Advanced Control Blocks
The advanced control blocks provide a combination of PID and dynamiccontrol.
• The dead time compensator removes the effect of dead time from thesetpoint response of a single input/output process.
• The dual mode block combines PID control with on/off control.
• Two blocks provide feedforward control: feedforward output adjust, andfeedforward setpoint adjust.
• The ratio station block keeps a constant ratio between two variables.
The advanced control blocks have the basic functionality of the PID block.See the appropriate section of Chapter 3, “Standard Control Blocks,” for anexplanation of the operation of the PID block. The external anti-resetwindup protection can also be used with dynamic blocks. See Chapter 6,“Other Control Blocks,” for information about these control blocks.
The following I/O elements are not visible on the block, but are available foruse in the Block Properties I/O folder as described for the PID function blockin Chapter 3: DER_GAINL, REV_ACTING, SQ_ERR, DEADB_ERR, andBIAS_FREEZE.
Some of the advanced control blocks incorporate the lead and lead-lagfunctions of the dynamic blocks. Refer to Chapter 4 for details on dynamiccontrol blocks to determine the parameters for first order lag, first orderlead-lag, second order lag, and second order lead-lag.
Overview
PID Functions
Dynamic Functions
5-3SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
5.2 DTC (Dead Time Compensator)
The DTC function block (FB413) removes the effect of dead time from thesetpoint response of a single input, single output process.
The DTC block includes a PID loop and has the same basic options andoperating characteristics as those listed in Chapter 3 on standard controlblocks. However, you cannot include any associated math and you mustconfigure the dynamic model.
The DTC block is basically the traditional Smith Predictor controlalgorithm. You have the option of choosing either a first or second order lagplus a dead time dynamic model.
The model is driven by the output of the PID that also controls the inputvariable. The output is sent through a model with a dead time block and issubtracted from the process input PV to generate an error. The error and themodel output are added together and sent to the PID loop as the processsignal.
Two block I/O variables are used to compute the process signal: MOUT(model output including the delay) and DMOUT (model output without thedelay). The signal is based on the following formula.
LPV = DMOUT + (LPV - MOUT)
This value can also be monitored with the SPV (“seen” process variable)output.
Overview
5-4 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
DTC (Dead Time Compensator) (continued)
When you use a DTC block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_P (FB394)
• ALARM_8P (SFB35)
• RD_SINFO (SFC6)
Figure 5-1 shows the dead time compensator functionality.
DEAD TIME COMPENSATOR
P I D
LMN
SP
PV
MODEL
DELAY
+
+
+
SPV
MOUT
DMOUT
LMN
--
PV
Figure 5-1 Dead Time Compensator DTC
Required Blocks
BlockConfiguration
5-5SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
The DTC function block is shown in Figure 5-2, and its inputs and outputsare described in Table 5-1 and Table 5-2. A more extensive discussion ofsome of these inputs and outputs begins on page 3-12.
OB351
BO EN
R ALM_PRES
Dead1
DTC
ENO BO
MASTER_G BO
IMAN BO
IAUTO BO
ICASC BO
SERR BO
INHHA BO
INHA BO
INLA BO
INLLA BO
INYDA BO
INODA BO
INRCA BO
OVRUN BO
1
2.0
Dead Time Compensator
BO NRDY
BO RMAN
0
0
SMODE I
ERR R
LPV R
LSP R
LMN R
0 BO RCAS
0 BO RATO
BO GMAN
BO GAUTO
BO GCASC
0
0
0
R SAMPLE_T0.1
R PID_ST1.0
R SP0.0
R SPH
R SPL
1.0
0.0
R RSP0.0
R PV0.0
R PVH1.0
I SP_TYPE0
R PVL0.0
BO BTA0
BIAS_O R
(Figure continuedon next page.)
Figure 5-2 DTC Block
The DTC Block
5-6 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
DTC (Dead Time Compensator) (continued)
R HHA
R HA
R LA
R LLA
R RCA
R KD
R OUT
I AWS
R HLIM
R LLIM
0.9
0.8
0.2
0.1
1.0
10.0
0.0
0
1.0
0.0
R KC
R TI
R TD
1.0
999.99
0.0
R BIAS0.0
R ADB0.01
R TAU1
R TAU2
R DTIME
BO DYN_TYPE
R DGAIN
I LOOP_TYP
20.0
0.0
0.0
0
1.0
4
R ODA
R YDA
0.2
0.1
R DYN_ST1.0
MOUT R
DMOUT R
SPV R
Figure 5-2 DTC Block (continued)
5-7SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
Table 5-1 Input Table for DTC
Element Description Type InitialValue
EN Enable BOOL 1
RMAN Request manual mode BOOL 0
RATO Request automatic mode BOOL 0
RCAS Request cascade mode BOOL 0
GMAN Go to manual mode BOOL 0
GAUTO Go to automatic mode BOOL 0
GCASC Go to cascade mode BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T * Unit of sample time (in seconds) REAL 0.1
PID_ST PID sample time (in seconds) REAL 1.0
ALM_PRESET Alarm preset time (in seconds) REAL 2.0
SP_TYPE Setpoint type: 0 = none, 1 = cascaded, 2 = computed INT 0
SP Setpoint REAL 0.0
RSP Remote setpoint REAL 0.0
SPH Setpoint high limit REAL 1.0
SPL Setpoint low limit REAL 0.0
PV Process variable REAL 0.0
PVH PV high limit REAL 1.0
PVL PV low limit REAL 0.0
BTA Broken transmitter alarm BOOL 0
ADB Alarm deadband REAL 0.01
HHA High-high alarm limit REAL 0.9
HA High alarm limit REAL 0.8
LA Low alarm limit REAL 0.2
LLA Low-low alarm limit REAL 0.1
ODA Orange deviation limit REAL 0.2
YDA Yellow deviation limit REAL 0.1
RCA Rate-of-change limit REAL 1.0
* See discussion of SAMPLE_T on page 1-13.
Table continues on next page.
5-8 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
DTC (Dead Time Compensator) (continued)
Table 5-1 Input Table for DTC (continued)
Element Description Type InitialValue
LOOP_TYPE Loop type: 0 = P, 1 = I, 2 = PI, 3 = PD, 4 = PID INT 4
KC Proportional gain REAL 1.0
TI Reset time (in minutes) REAL 999.99
TD Derivative time (in minutes) REAL 0.0
KD Derivative gain REAL 10.0
DGAIN Steady-state gain REAL 1.0
TAU1 Lag time constant 1 (in seconds) REAL 20.0
TAU2 Lag time constant 2 (in seconds) REAL 0.0
DTIME Dead time (in seconds) REAL 0.0
DYN_TYPE 1 = SOLAG, 0 = FOLAG BOOL 0
DYN_ST Dynamic function sample time REAL 1.0
AWS Anti-reset windup INT 0
HLIM High limit for output REAL 1.0
LLIM Low limit for output REAL 0.0
OUT PID output (0.0 to 1.0) REAL 0.0
BIAS PID bias REAL 0.0
DER_GAINL ** Derivative gain limiting BOOL 0
REV_ACTING ** 1 = reverse acting, 0 = direct acting BOOL 0
SQ_ERR ** Control based on squared error BOOL 0
DEADB_ERR ** Control based on deadband error BOOL 0
BIAS_FREEZE ** Freeze bias when output is out of range BOOL 0
MAL_HL ** Monitor high and low alarms BOOL 1
MAL_HHLL ** Monitor high-high/low-low alarms BOOL 1
MDEV_YO ** Monitor yellow/orange deviations BOOL 1
MRCA ** Monitor rate-of-change alarm BOOL 1
** These inputs are invisible but function as described in Chapter 3. To make the inputs visible see theprocedure on page1-14.
5-9SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
Table 5-2 Output Table for DTC
Element Description Type InitialValue
ENO Output valid BOOL 0
MASTER_GMAN Output for setting the master to manual BOOL 0
IMAN Loop in manual mode BOOL 0
IAUTO Loop in auto mode BOOL 0
ICASC Loop in cascade mode BOOL 0
SERR Sign error: 1 = --, 0 = + BOOL 0
INHHA Loop in high-high alarm: PV > HHA BOOL 0
INHA Loop in high alarm: PV > HA BOOL 0
INLA Loop in low alarm: PV < LA BOOL 0
INLLA Loop in low-low alarm: PV < LLA BOOL 0
INYDA Loop in yellow deviation alarm: ERR > ABS(YDA) BOOL 0
INODA Loop in orange deviation: ERR > ABS(ODA) BOOL 0
INRCA Loop in rate-of-change alarm BOOL 0
OVRUN Loop overrunning BOOL 0
SMODE Block status INT 0
ERR Loop error REAL 0.0
BIAS_O Loop bias output REAL 0.0
LPV Internal PV REAL 0.0
LSP Internal SP REAL 0.0
LMN Internal output REAL 0.0
MOUT Model output with delay REAL 0.0
DMOUT Model output without delay REAL 0.0
SPV “Seen” process variable REAL 0.0
5-10 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
5.3 DMD (Dual Mode)
The DMD function block (FB414) provides a mechanism to start up aprocess variable in a minimum amount of time and with a minimumamount of overshoot.
The DMD function block combines PID control with on/off control. The PIDloop must be in auto or cascade mode before you enable the dual mode block.The PID loop has the same options and operating characteristics as thoselisted in Chapter 3, “Standard Control Blocks.” You cannot includeassociated math on the output because the dual mode block operates on theoutput of the PID loop.
To properly control the dual mode block, perform the following steps:
1. Place the PID loop in auto or cascade.
2. After the loop is in the appropriate mode, enable the dual mode block.
3. Change the setpoint to the desired value to move the process variableinto orange deviation.
When the dual mode block is enabled, the DMODE output is set to 1 andretains that value until the PID loop takes control. When the processdeviation crosses the orange deviation line, the following steps occur(Figure 5-3):
1. The output is set to 100% until the process re-crosses the orangedeviation line.
2. The output is set to 0% for the first time interval DLY1 that you specify.
3. The output is set to the preset value PRSET for the second time intervalDLY2 that you specify.
4. The bias is set to the preset value, and control is returned to the PIDloop.
5. The dual mode portion is deactivated until it is reset by setting theENABL input to true(1).
The orange deviation and the delay times are the critical tuning constantsfor proper operation of the dual mode block. The block assumes that theprocess variable starts at a point below the orange deviation limit. Initialsetpoint change must be large enough to push the error into orangedeviation.
Overview
5-11SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
After the loop gets control of the process, you can change the deviationlimits by writing to the appropriate extension variables.
Yellow deviation
Yellow deviation
Orange deviation
Orange deviation
Error
100%
0%
Preset
delaytime 1
delaytime 2
Loop control takes over
error crossesorange deviation
error re-crossesorange deviation
DMODE = 0DMODE = 1
Setpoint
Output
Figure 5-3 Dual Mode Operation
When you use a DMD block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_P (FB394)
• ALARM_8P (SFB35)
• RD_SINFO (SFC6)
• ADAPTER (FB393)
• ASC_DMD (FB437), or any associated math block that you create
An associated math block must be specified for each DMD block. If you donot require associated math, select the place-holding associated math block,ASC_DMD, and set the values of ASO_PV, ASO_AUTO, and ASO_CASC to 0.
Required Blocks
5-12 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
DMD (Dual Mode) (continued)
The DMD block must be activated with the REN input or with anassignment statement that sets the ENABL input to true. The dual modeblock can also be enabled from an assignment statement within an SFCstep.
To deactivate the DMD block, use the RDIS input or set the ENABL input tofalse.
The dual mode block has a Boolean input (NRDY) that you can use tointerlock the execution of the block to some external conditions:
• If you set the NRDY input to true, the block is forced to the disabledstate.
• To return the block to the enabled state you must not only set the NRDYinput to false, but you must also re-enable the block.
Enabling andDisabling Blocks
5-13SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
The DMD function block is shown in Figure 5-4, and its inputs and outputsare described in Table 5-3 and Table 5-4. A more extensive discussion ofsome of these inputs and outputs begins on page 3-12.
OB351
BO EN
R ALM_PRES
FB ASO_FB
BO ASO_PV
BO ASO_AUTO
BO ASO_CAS
Dmloop3
DMD
ENO BO
MASTER_G BO
IMAN BO
IAUTO BO
ICASC BO
SERR BO
INHHA BO
INHA BO
INLA BO
INLLA BO
INYDA BO
INODA BO
INRCA BO
OVRUN BO
1
2.0
0
0
0
Dual Mode
BO NRDY
BO RMAN
0
0
DMODE BO
ERR R
LPV R
LSP R
0 BO RCAS
0 BO RATO
BO GMAN
BO GAUTO
BO GCASC
0
0
0
R SAMPLE_T0.1
R PID_ST1.0
R SP0.0
I SP_TYPE0
0
BIAS_O R
(Figure continuedon next page.)
LMN RR RSP0.0
BO REN0
0 BO RDIS
BO ENABL0 SMODE I
Figure 5-4 DMD Block
The DMD Block
5-14 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
DMD (Dual Mode) (continued)
R HHA
R HA
R LA
R LLA
R RCA
R KD
R OUT
I AWS
R HLIM
R LLIM
0.9
0.8
0.2
0.1
1.0
10.0
0.0
0
1.0
0.0
R KC
R TI
R TD
1.0
999.99
0.0
R BIAS0.0
R ADB0.01
R DLY1
R DLY2
R PRSET
I LOOP_TYP
0
0
0
4
R ODA
R YDA
0.2
0.1
R SPH
R SPL
1.0
0.0
R PV0.0
R PVH1.0
R PVL0
BO BTA0
R BIAS
Figure 5-4 DMD Block (continued)
5-15SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
Table 5-3 Input Table for DMD
Element Description Type InitialValue
EN Enable BOOL 1
ASO_FB FB number for associated function block FB 0
ASO_PV Enable associated math on PV cycle BOOL 0
ASO_AUTO Enable associated math during auto mode BOOL 0
ASO_CAS Enable associated math during cascade mode BOOL 0
REN Request enable BOOL 0
RDIS Request disable BOOL 0
RMAN Request manual mode BOOL 0
RATO Request automatic mode BOOL 0
RCAS Request cascade mode BOOL 0
GMAN Go to manual mode BOOL 0
GAUTO Go to automatic mode BOOL 0
GCASC Go to cascade mode BOOL 0
NRDY Not ready BOOL 0
ENABL Enable BOOL 0
SAMPLE_T * Unit of sample time (in seconds) REAL 0.1
PID_ST PID sample time (in seconds) REAL 1.0
ALM_PRESET Alarm preset time (in seconds) REAL 2.0
SP_TYPE Setpoint type: 0 = none, 1 = cascaded, 2 = computed INT 0
SP Setpoint REAL 0.0
RSP Remote setpoint REAL 0.0
SPH Setpoint high limit REAL 1.0
SPL Setpoint low limit REAL 0.0
PV Process variable REAL 0.0
PVH PV high limit REAL 1.0
PVL PV low limit REAL 0.0
BTA Broken transmitter alarm BOOL 0
ADB Alarm deadband REAL 0.01
* See discussion of SAMPLE_T on page 1-13.
Table continues on next page.
5-16 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
DMD (Dual Mode) (continued)
Table 5-3 Input Table for DMD (continued)
Element Description Type InitialValue
HHA High-high alarm limit REAL 0.9
HA High alarm limit REAL 0.8
LA Low alarm limit REAL 0.2
LLA Low-low alarm limit REAL 0.1
ODA Orange deviation limit REAL 0.2
YDA Yellow deviation limit REAL 0.1
RCA Rate-of-change limit REAL 1.0
LOOP_TYPE Loop type: 0 = P, 1 = I, 2 = PI, 3 = PD, 4 = PID INT 4
KC Proportional gain REAL 1.0
TI Reset time (in minutes) REAL 999.99
TD Derivative time (in minutes) REAL 0.0
KD Derivative gain REAL 10.0
PRSET Preset output for dual mode REAL 0.0
DLY1 Delay time 1 for dual mode (in seconds) REAL 0.0
DLY2 Delay time 2 for dual mode (in seconds) REAL 0.0
AWS Anti-reset windup INT 0
HLIM High limit for output REAL 1.0
LLIM Low limit for output REAL 0.0
OUT PID output (0.0 to 1.0) REAL 0.0
BIAS PID bias REAL 0.0
DER_GAINL ** Derivative gain limiting BOOL 0
REV_ACTING ** 1 = reverse acting, 0 = direct acting BOOL 0
SQ_ERR ** Control based on squared error BOOL 0
DEADB_ERR ** Control based on deadband error BOOL 0
BIAS_FREEZE ** Freeze bias when output is out of range BOOL 0
MAL_HL ** Monitor high and low alarms BOOL 1
MAL_HHLL ** Monitor high-high/low-low alarms BOOL 1
MDEV_YO ** Monitor yellow/orange deviations BOOL 1
MRCA ** Monitor rate-of-change alarm BOOL 1
** These inputs are invisible but function as described in Chapter 3. To make the inputs visible see theprocedure on page1-14.
5-17SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
Table 5-4 Output Table for DMD
Element Description Type InitialValue
ENO Output valid BOOL 0
MASTER_GMAN Output for setting the master to manual BOOL 0
IMAN Loop in manual mode BOOL 0
IAUTO Loop in auto mode BOOL 0
ICASC Loop in cascade mode BOOL 0
SERR Sign error: 1 = --, 0 = + BOOL 0
INHHA Loop in high-high alarm: PV > HHA BOOL 0
INHA Loop in high alarm: PV > HA BOOL 0
INLA Loop in low alarm: PV < LA BOOL 0
INLLA Loop in low-low alarm: PV < LLA BOOL 0
INYDA Loop in yellow deviation alarm: ERR > ABS(YDA) BOOL 0
INODA Loop in orange deviation: ERR > ABS(ODA) BOOL 0
INRCA Loop in rate-of-change alarm BOOL 0
OVRUN Loop overrunning BOOL 0
SMODE Block status INT 0
DMODE Dual mode is running BOOL 0
ERR Loop error REAL 0.0
BIAS_O Loop bias output REAL 0.0
LPV Internal PV REAL 0.0
LSP Internal SP REAL 0.0
LMN Internal output REAL 0.0
5-18 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
DMD (Dual Mode) (continued)
Associated math is provided to expand the capability of the DMD blocks. Allmath associated with a DMD block must be contained within a separatefunction block. This function block is specified for the DMD block in theblock input ASO_FB. The function block is then called when the DMD blockexecutes, based upon the selection of associated math inputs. See page 3-22for information on using the associated math inputs and outputs.
SCL (Structured Control Language) code for the ASC_DMD function blockis provided in the OSx Library for you to copy and modify as needed. SelectFile-->Open from the SIMATIC Manager, double-click the S7 Program folder,and double-click the Source folder. Then click the circle next to Libraries, andselect OSx Library from the list. Double-click the ASC_DMD block to open it.
The following example shows an associated math block for DMD:
//***EXAMPLE***// This is an example block for associating math on PV// update for the DMD block. All variables within the// DMD instance will be available under the declared// structure ADMD.
FUNCTION_BLOCK “ASC_DMD”;TITLE=’ASC_DMD’;AUTHOR: OSxLib;NAME: ASC_DMD;FAMILY: ADVANCED;VERSION: ’4.11’://KNOW_HOW_PROTECT;
VARADMD:DMD; //Declare an instance of DMD
END_VAR; //This provides a map into the DMD block
// NOTE: Do not declare any additional variables// within this block.
CONST// Associate math identifiers for siFunctionASSOC_PV :=0; // Associate math on PV updateASSOC_AUTO :=1; // Associate math on autoASSOC_CASC :=2; // Associate math on cascade
END_CONST;
Associated Math
5-19SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
BEGIN
(* Associated math can be called from any of threepoints within the DMD block. These points are:
During Process variable updateDuring Auto mode calculationsDuring Cascade mode calculations
This function block (ASC_DMD) is called from eachof these points when enabled. The locationthis block is called from is contained in thevariable ADMD.siFunction. This integer variablecontains a number from 0 to 2. These numbers matchthe constants declared above.
ASSOC_PV :=0; // Associate math on PV updateASSOC_AUTO :=1; // Associate math on autoASSOC_CASC :=2; // Associate math on cascade
The ADMD.siFunction variable must be checkedbefore doing any calculations so that the correctcalculation is done at the correct time:
*)
// Determine which part of the DMD called associated math
CASE ADMD.siFunction OF
ASSOC_PV:// If in manual mode, set output to 40% of PVIF (ADMD.IMAN = TRUE) THEN
ADMD.OUT := ADMD.PV * 0.40;END_IF;
ASSOC_AUTO://Place any operations to be done when DMD is//in auto mode here:
;
ASSOC_CASC://Place any operations to be done when DMD is//in cascade mode here:
END_CASE;
END_FUNCTION_BLOCK
5-20 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
5.4 FFOA (Feedforward Output Adjust)
The FFOA block (FB415) uses two independent control blocks, a PID loopand a dynamic simulation block, to drive a single output. The function of thefeedforward output adjust block is to incorporate the features of a dynamicblock and a PID block into a single block so that the output is alwaysupdated correctly. The feedforward output adjust uses the velocity algorithmwhere the output spans --1.0 to 1.0.
• On each update, the block adds the contribution of the dynamic block.If the output has exceeded a limit, the block sets the output to the limitvalue.
• The PID output is then used for further adjustment. If the PID ispushing the block beyond a limit, the output is set to the limit value,and the AWS (anti-reset windup status) input is set as explained inChapter 3, “Standard Blocks.”
• If the dynamic block is pushing the output beyond a limit while theloop is moving it away, the loop has final control; and the output ismoved away from the limit.
The PID block has control of the output which is updated each loop scan orevery two seconds, whichever is faster.
NOTE: The sample time of the PID loop should match the dynamic sampletime.
The REN and RDIS inputs control the dynamic block. The PID block respondsto the standard PID commands. You can monitor FMODE (feedforward mode)to determine the status of the block: 1 indicates that the block is executing;0 indicates that the block is disabled; 3 indicates that the block isinitializing.
A typical application of the feedforward output adjust block is to reject theeffect of a known, measurable disturbance on the controlled variable. Thedisturbance variable has no default name in the form that you use to definethe block.
Overview
5-21SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
When you use a FFOA block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_P (FB394)
• ALARM_8P (SFB35)
• RD_SINFO (SFC6)
Figure 5-5 shows how the FFOA operates.
FEEDFORWARD OUTPUT ADJUST
P I D
LMN
DYNAMIC
PV
SP
DV
Figure 5-5 Fast Forward Output Adjustment
Required Blocks
BlockConfiguration
5-22 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
FFOA (Feedforward Output Adjust) (continued)
The FFOA function block is shown in Figure 5-6, and its inputs and outputsare described in Table 5-5 and Table 5-6. A more extensive discussion ofsome of these inputs and outputs begins on page 3-12.
OB351
BO EN
R ALM_PRES
BO REN
BO RDIS
Feed_1
FFOA
ENO BO
MASTER_G BO
IMAN BO
IAUTO BO
ICASC BO
SERR BO
INHHA BO
INHA BO
INLA BO
INLLA BO
INYDA BO
INODA BO
INRCA BO
OVRUN BO
1
2.0
0
Feed Forward Output Adjust
BO NRDY
BO RMAN
0
0
SMODE I
ERR R
LPV R
LSP R
LMN R
0 BO RCAS
0 BO RATO
BO GMAN
BO GAUTO
BO GCASC
0
0
0
R SAMPLE_T0.1
R PID_ST1.0
R SP0.0
R SPH
R SPL
1.0
0.0
R RSP0.0
R PV0.0
R PVH1.0
I SP_TYPE0
0
BIAS_O R
(Figure continued on next page.)
BO ENABL0
FMODE I
Figure 5-6 FFOA Block
The FFOA Block
5-23SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
R HHA
R HA
R LA
R LLA
R RCA
R KD
R OUT
I AWS
R HLIM
R LLIM
0.9
0.8
0.2
0.1
1.0
10.0
0.0
0
1.0
0.0
R KC
R TI
R TD
1.0
999.99
0.0
R PVL0.0
R ADB0.01
I DYN_TYPE
R DYN_ST
R TAU1
R TAU2
R DGAIN
I LOOP_TYP
1
1.0
10.0
20.0
1.0
4
R ODA
R YDA
0.2
0.1
R TLEAD
R DTIME
5.0
0.0
BO BTA0
R WPV0.0
R BIAS0.0
DOUT R
SOUT R
Figure 5-6 FFOA Block (continued)
5-24 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
FFOA (Feedforward Output Adjust) (continued)
Table 5-5 Input Table for FFOA
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
RMAN Request manual mode BOOL 0
RATO Request automatic mode BOOL 0
RCAS Request cascade mode BOOL 0
GMAN Go to manual mode BOOL 0
GAUTO Go to automatic mode BOOL 0
GCASC Go to cascade mode BOOL 0
NRDY Not ready BOOL 0
ENABL Enable BOOL 0
SAMPLE_T * Unit of sample time (in seconds) REAL 0.1
PID_ST PID sample time (in seconds) REAL 1.0
ALM_PRESET Alarm preset time (in seconds) REAL 2.0
SP_TYPE Setpoint type: 0 = none, 1 = cascaded, 2 = computed INT 0
SP Setpoint REAL 0.0
RSP Remote setpoint REAL 0.0
SPH Setpoint high limit REAL 1.0
SPL Setpoint low limit REAL 0.0
PV Process variable REAL 0.0
PVH PV high limit REAL 1.0
PVL PV low limit REAL 0.0
WPV Disturbance variable REAL 0.0
BTA Broken transmitter alarm BOOL 0
ADB Alarm deadband REAL 0.01
HHA High-high alarm limit REAL 0.9
HA High alarm limit REAL 0.8
LA Low alarm limit REAL 0.2
LLA Low-low alarm limit REAL 0.1
* See discussion of SAMPLE_T on page 1-13.
Table continues on next page.
5-25SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
Table 5-5 Input Table for FFOA (continued)
Element Description Type InitialValue
ODA Orange deviation limit REAL 0.2
YDA Yellow deviation limit REAL 0.1
RCA Rate-of-change limit REAL 1.0
LOOP_TYPE Loop type: 0 = P, 1 = I, 2 = PI, 3 = PD, 4 = PID INT 4
KC Proportional gain REAL 1.0
TI Reset time (in minutes) REAL 999.99
TD Derivative time (in minutes) REAL 0.0
KD Derivative gain REAL 10.0
DGAIN Steady-state gain REAL 1.0
DYN_TYPE 1 = FOLAG, 2 = FOLL, 3 = SOLAG, 4 = SOLL INT 1
DYN_ST Dynamic function sample time REAL 1.0
TAU1 Lag time constant 1 (in seconds) REAL 10.0
TAU2 Lag time constant 2 (in seconds) REAL 20.0
TLEAD Lead time constant (in seconds) REAL 5.0
DTIME Dead time (in seconds) REAL 0.0
AWS Anti-reset windup INT 0
HLIM High limit for output REAL 1.0
LLIM Low limit for output REAL 0.0
OUT PID output (0.0 to 1.0) REAL 0.0
BIAS PID bias REAL 0.0
DER_GAINL ** Derivative gain limiting BOOL 0
REV_ACTING ** 1 = reverse acting, 0 = direct acting BOOL 0
SQ_ERR ** Control based on squared error BOOL 0
DEADB_ERR ** Control based on deadband error BOOL 0
BIAS_FREEZE ** Freeze bias when output is out of range BOOL 0
MAL_HL ** Monitor high and low alarms BOOL 1
MAL_HHLL ** Monitor high-high/low-low alarms BOOL 1
MDEV_YO ** Monitor yellow/orange deviations BOOL 1
MRCA ** Monitor rate-of-change alarm BOOL 1
** These inputs are invisible but function as described in Chapter 3. To make the inputs visible see theprocedure on page1-14.
5-26 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
FFOA (Feedforward Output Adjust) (continued)
Table 5-6 Output Table for FFOA
Element Description Type InitialValue
ENO Output valid BOOL 0
MASTER_GMAN Output for setting the master to manual BOOL 0
IMAN Loop in manual mode BOOL 0
IAUTO Loop in auto mode BOOL 0
ICASC Loop in cascade mode BOOL 0
SERR Sign error: 1 = --, 0 = + BOOL 0
INHHA Loop in high-high alarm: PV > HHA BOOL 0
INHA Loop in high alarm: PV > HA BOOL 0
INLA Loop in low alarm: PV < LA BOOL 0
INLLA Loop in low-low alarm: PV < LLA BOOL 0
INYDA Loop in yellow deviation alarm: ERR > ABS(YDA) BOOL 0
INODA Loop in orange deviation: ERR > ABS(ODA) BOOL 0
INRCA Loop in rate-of-change alarm BOOL 0
OVRUN Loop overrunning BOOL 0
SMODE Loop status INT 0
FMODE Feed forward block status INT 0
ERR Loop error REAL 0.0
BIAS_O Loop bias output REAL 0.0
LPV Internal PV REAL 0.0
LSP Internal SP REAL 0.0
LMN Internal output REAL 0.0
DOUT Dynamic output REAL 0.0
SOUT Loop output REAL 0.0
5-27SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
5.5 FFSA (Feedforward Setpoint Adjust)
The FFSA function block (FB416) allows you to insert a dynamic blockbetween the output of a segment of math and the setpoint of a PID loop. Thedynamic block is not required; however, without it, this block has the sameeffect as a PID block with associated math in cascade mode. Associatedmath is also optional, and you must configure it if your application requiresa math section. See page 5-34 for configuring associated math.
Because the FFSA function block operates on the output of the loop, youcannot associate math on the output.
With the dynamic block, the feedforward setpoint adjust block has thefollowing operation. For a discussion on SMODE, see page 3-27.
• When the loop is not in cascade mode (SMODE = 0 through 4), the mathblock is not executed.
• When the PID goes into cascade mode (SMODE = 5), the dynamic blockis initialized using the backward initialization algorithm. (The currentoutput becomes the initial simulated output condition, and the initialsimulated input condition is computed as the output divided by thegain.)
• After initialization (SMODE = 6), the block executes the math and sendsthe output through the dynamic block. The output of the dynamic blockis used by the PID as the setpoint.
Overview
5-28 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
FFSA (Feedforward Setpoint Adjust) (continued)
When you use an FFSA block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_P (FB394)
• ALARM_8P (SFB35)
• RD_SINFO (SFC6)
• ADAPTER (FB393)
• ASC_FFSA (FB438), or any associated math block that you create
An associated math block must be specified for each FFSA block. If you donot require associated math, select the place-holding associated math block,ASC_FFSA, and set the value of ASO_CAS to 0.
Figure 5-7 shows how the FFSA function block operates.
FEEDFORWARD SETPOINT ADJUST
P I D
LMN
DYNAMIC
PVMATH
MTHI
Figure 5-7 Feedforward Setpoint Adjust
Required Blocks
BlockConfiguration
5-29SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
The FFSA function block is shown in Figure 5-8, and its inputs and outputsare described in Table 5-7 and Table 5-8. A more extensive discussion ofsome of these inputs and outputs begins on page 3-12.
OB351
BO EN
R ALM_PRES
FB ASO_FB
BO ASO_CAS
Fdfwd_2
FFSA
ENO BO
MASTER_G BO
IMAN BO
IAUTO BO
ICASC BO
SERR BO
INHHA BO
INHA BO
INLA BO
INLLA BO
INYDA BO
INODA BO
INRCA BO
OVRUN BO
1
2.0
0
Feed Forward Setpoint Adjust
BO NRDY
BO RMAN
0
0
SMODE I
ERR R
LPV R
LSP R
LMN R
0 BO RCAS
0 BO RATO
BO GMAN
BO GAUTO
BO GCASC
0
0
0
R SAMPLE_T0.1
R PID_ST1.0
R SP0.0
R SPH
R SPL
1.0
0.0
R RSP0.0
R PV0.0
R PVH1.0
R PVL0
0
BO BTA0
BIAS_O R
(Figure continuedon next page.)
Figure 5-8 FFSA Block
The FFSA Block
5-30 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
FFSA (Feedforward Setpoint Adjust) (continued)
R HHA
R HA
R LA
R LLA
R RCA
R KD
R OUT
I AWS
R HLIM
R LLIM
0.9
0.8
0.2
0.1
1.0
10.0
0.0
0
1.0
0.0
R KC
R TI
R TD
1.0
999.99
0.0
R BIAS0.0
R ADB0.01
R DYN_ST
R TAU1
R TAU2
R TLEAD
I DYN_TYPE
BO VELO_ALG
I LOOP_TYP
1.0
10.0
5.0
5.0
0
0
4
R ODA
R YDA
0.2
0.1
R MTHI0.0
R MTHO0.0
R DGAIN
R DTIME
1.0
0.0
Figure 5-8 FFSA Block (continued)
5-31SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
Table 5-7 Input Table for FFSA
Element Description Type InitialValue
EN Enable BOOL 1
ASO_FB FB number for associated function block FB 0
ASO_CAS Enable associated math during cascade mode BOOL 0
RMAN Request manual mode BOOL 0
RATO Request automatic mode BOOL 0
RCAS Request cascade mode BOOL 0
GMAN Go to manual mode BOOL 0
GAUTO Go to automatic mode BOOL 0
GCASC Go to cascade mode BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T * Unit of sample time (in seconds) REAL 0.1
PID_ST PID sample time (in seconds) REAL 1.0
ALM_PRESET Alarm preset time (in seconds) REAL 2.0
SP Setpoint REAL 0.0
RSP Remote setpoint REAL 0.0
SPH Setpoint high limit REAL 1.0
SPL Setpoint low limit REAL 0.0
PV Process variable REAL 0.0
PVH PV high limit REAL 1.0
PVL PV low limit REAL 0.0
BTA Broken transmitter alarm BOOL 0
ADB Alarm deadband REAL 0.01
HHA High-high alarm limit REAL 0.9
HA High alarm limit REAL 0.8
LA Low alarm limit REAL 0.2
LLA Low-low alarm limit REAL 0.1
ODA Orange deviation limit REAL 0.2
YDA Yellow deviation limit REAL 0.1
RCA Rate-of-change limit REAL 1.0
* See discussion of SAMPLE_T on page 1-13.
Table continues on next page.
5-32 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
FFSA (Feedforward Setpoint Adjust) (continued)
Table 5-7 Input Table for FFSA (continued)
Element Description Type InitialValue
VELO_ALG 1 = velocity algorithm, 0 = position algorithm BOOL 0
LOOP_TYPE Loop type: 0 = P, 1 = I, 2 = PI, 3 = PD, 4 = PID INT 4
KC Proportional gain REAL 1.0
TI Reset time (in minutes) REAL 999.99
TD Derivative time (in minutes) REAL 0.0
KD Derivative gain REAL 10.0
DYN_TYPE 1 = FOLAG, 2 = FOLL, 3 = SOLAG, 4 = SOLL INT 0
DYN_ST Dynamic function sample time REAL 1.0
TAU1 Lag time constant 1 (in seconds) REAL 10.0
TAU2 Lag time constant 2 (in seconds) REAL 5.0
TLEAD Lead time constant (in seconds) REAL 5.0
DGAIN Steady-state gain REAL 1.0
DTIME Dead time (in seconds) REAL 0.0
AWS Anti-reset windup INT 0
HLIM High limit for output REAL 1.0
LLIM Low limit for output REAL 0.0
OUT PID output (0.0 to 1.0) REAL 0.0
BIAS PID bias REAL 0.0
MTHI Math block input REAL 0.0
MTHO Math block output REAL 0.0
DER_GAINL ** Derivative gain limiting BOOL 0
REV_ACTING ** 1 = reverse acting, 0 = direct acting BOOL 0
SQ_ERR ** Control based on squared error BOOL 0
DEADB_ERR ** Control based on deadband error BOOL 0
BIAS_FREEZE ** Freeze bias when output is out of range BOOL 0
MAL_HL ** Monitor high and low alarms BOOL 1
MAL_HHLL ** Monitor high-high/low-low alarms BOOL 1
MDEV_YO ** Monitor yellow/orange deviations BOOL 1
MRCA ** Monitor rate-of-change alarm BOOL 1
** These inputs are invisible but function as described in Chapter 3. To make the inputs visible see theprocedure on page1-14.
5-33SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
Table 5-8 Output Table for FFSA
Element Description Type InitialValue
ENO Output valid BOOL 0
MASTER_GMAN Output for setting the master to manual BOOL 0
IMAN Loop in manual mode BOOL 0
IAUTO Loop in auto mode BOOL 0
ICASC Loop in cascade mode BOOL 0
SERR Sign error: 1 = --, 0 = + BOOL 0
INHHA Loop in high-high alarm: PV > HHA BOOL 0
INHA Loop in high alarm: PV > HA BOOL 0
INLA Loop in low alarm: PV < LA BOOL 0
INLLA Loop in low-low alarm: PV < LLA BOOL 0
INYDA Loop in yellow deviation alarm: ERR > ABS(YDA) BOOL 0
INODA Loop in orange deviation: ERR > ABS(ODA) BOOL 0
INRCA Loop in rate-of-change alarm BOOL 0
OVRUN Loop overrunning BOOL 0
SMODE Block status INT 0
ERR Loop error REAL 0.0
BIAS_O Loop bias output REAL 0.0
LPV Internal PV REAL 0.0
LSP Internal SP REAL 0.0
LMN Internal output REAL 0.0
5-34 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
FFSA (Feedforward Setpoint Adjust) (continued)
Associated math is provided to expand the capability of the FFSA blocks. Allmath associated with a FFSA block must be contained within a separatefunction block. This function block is specified for the FFSA block in theblock input ASO_FB. The function block is then called when the FFSA blockexecutes when in cascade mode. See page 3-22 for information on using theassociated math inputs and outputs.
SCL (Structured Control Language) code for the ASC_FFSA function blockis provided in the OSx Library for you to copy and modify as needed. SelectFile→Open from the SIMATIC Manager, double-click the S7 Program folder,and double-click the Source folder. Then click the circle next to Libraries, andselect OSx Library from the list. Double-click the ASC_FFSA block to open it.
The following example shows an associated math block for FFSA:
//***EXAMPLE***// This is an example block for associating math with// the FFSA block. All variables within the FFSA// instance will be available under the declared// structure AFFSA.
FUNCTION_BLOCK “ASC_FFSA”;TITLE=’ASC_FFSA’;AUTHOR: OSxLib;NAME: ASC_FFSA;FAMILY: ADVANCED;VERSION: ’4.11’://KNOW_HOW_PROTECT;
VARAFFSA:FFSA; //Declare an instance of FFSA
//This provides a map into the FFSA blockEND_VAR;
// NOTE: Do not declare any additional variables// within this block.
BEGIN
// Place any operations to be done when FFSA is in// cascade mode here.
AFFSA.MTHO := AFFSA.MTHI;
END_FUNCTION_BLOCK
Associated Math
5-35SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
5.6 RATIO (Ratio Station)
The RATIO function block (FB417) is used to keep a constant ratio betweentwo process variables. The setpoint to the block is the ratio that you want tomaintain between a controlled variable and an uncontrolled (wild) processvariable.
To ensure a bumpless transfer, the algorithm keeps the setpoint and theoutput unchanged during the transition from manual or automatic tocascade mode. Thereafter, the loop uses the following formula to computethe loop setpoint and bring the process variable to the appropriate value:
setpoint = (ratio setpoint × wild variable) + offset
When you use a RATIO block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_P (FB394)
• ALARM_8P (SFB35)
• RD_SINFO (SFC6)
Figure 5-9 shows the graphic for a ratio station CFB.
RATIO STATION
P I D
OUT
SP
OFFSET
A X B
WPV
PVuncontrolledvariable
ratiosetpoint
controlledvariable
loopsetpoint
+
+
Figure 5-9 Ratio Station Graphic
Overview
Required Blocks
BlockConfiguration
5-36 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
RATIO (Ratio Station) (continued)
The RATIO function block is shown in Figure 5-10, and its inputs andoutputs are described in Table 5-9 and Table 5-10. A more extensivediscussion of some of these inputs and outputs begins on page 3-12.
OB351
BO EN
R ALM_PRES
Ratio6
RATIO
ENO BO
MASTER_G BO
IMAN BO
IAUTO BO
ICASC BO
SERR BO
INHHA BO
INHA BO
INLA BO
INLLA BO
INYDA BO
INODA BO
INRCA BO
OVRUN BO
1
2.0
Ratio Station
BO NRDY
BO RMAN
0
0
SMODE I
ERR R
LPV R
LSP R
LMN R
0 BO RCAS
0 BO RATO
BO GMAN
BO GAUTO
BO GCASC
0
0
0
R SAMPLE_T0.1
R PID_ST1.0
R SP0.0
R SPH
R SPL
1.0
0.0
R RSP0.0
R PV0.0
R PVH1.0
R PVL0.0
BO BTA0
BIAS_O R
(Figure continued on next page.)
R SP_OFFST0.0
R WPV0.0
R WPVH1.0
R WPVL0.0
R ADB0.01
RATIO_O R
Figure 5-10 RATIO Block
The RATIO Block
5-37SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
R HA
R LA
R LLA
R RCA
R KD
R OUT
I AWS
R HLIM
R LLIM
0.8
0.2
0.1
1.0
10.0
0.0
0
1.0
0.0
R KC
R TI
R TD
1.0
999.99
0.0
R BIAS0.0
I LOOP_TYP4
R ODA
R YDA
0.2
0.1
R HHA0.9
Figure 5-10 RATIO Block (continued)
5-38 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
RATIO (Ratio Station) (continued)
Table 5-9 Input Table for RATIO
Element Description Type InitialValue
EN Enable BOOL 1
RMAN Request manual mode BOOL 0
RATO Request automatic mode BOOL 0
RCAS Request cascade mode BOOL 0
GMAN Go to manual mode BOOL 0
GAUTO Go to automatic mode BOOL 0
GCASC Go to cascade mode BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T * Unit of sample time (in seconds) REAL 0.1
PID_ST PID sample time (in seconds) REAL 1.0
ALM_PRESET Alarm preset time (in seconds) REAL 2.0
SP Setpoint REAL 0.0
RSP Remote setpoint REAL 0.0
SPH Setpoint high limit REAL 1.0
SPL Setpoint low limit REAL 0.0
SP_OFFST Setpoint offset REAL 0.0
PV Process variable REAL 0.0
PVH PV high limit REAL 1.0
PVL PV low limit REAL 0.0
WPV Wild process variable REAL 0.0
WPVH WPV high limit REAL 1.0
WPVL WPV low limit REAL 0.0
BTA Broken transmitter alarm BOOL 0
ADB Alarm deadband REAL 0.01
HHA High-high alarm limit REAL 0.9
HA High alarm limit REAL 0.8
LA Low alarm limit REAL 0.2
LLA Low-low alarm limit REAL 0.1
* See discussion of SAMPLE_T on page 1-13.
Table continues on next page.
5-39SIMATIC PCS 7 OSx 4.1.2 Library Advanced Control Blocks
Table 5-9 Input Table for RATIO (continued)
Element Description Type InitialValue
ODA Orange deviation limit REAL 0.2
YDA Yellow deviation limit REAL 0.1
RCA Rate-of-change limit REAL 1.0
LOOP_TYPE Loop type: 0 = P, 1 = I, 2 = PI, 3 = PD, 4 = PID INT 4
KC Proportional gain REAL 1.0
TI Reset time (in minutes) REAL 999.99
TD Derivative time (in minutes) REAL 0.0
KD Derivative gain REAL 10.0
AWS Anti-reset windup INT 0
HLIM High limit for output REAL 1.0
LLIM Low limit for output REAL 0.0
OUT PID output (0.0 to 1.0) REAL 0.0
BIAS PID bias REAL 0.0
DER_GAINL ** Derivative gain limiting BOOL 0
REV_ACTING ** 1 = reverse acting, 0 = direct acting BOOL 0
SQ_ERR ** Control based on squared error BOOL 0
DEADB_ERR ** Control based on deadband error BOOL 0
BIAS_FREEZE ** Freeze bias when output is out of range BOOL 0
MAL_HL ** Monitor high and low alarms BOOL 1
MAL_HHLL ** Monitor high-high/low-low alarms BOOL 1
MDEV_YO ** Monitor yellow/orange deviations BOOL 1
MRCA ** Monitor rate-of-change alarm BOOL 1
** These inputs are invisible but function as described in Chapter 3. To make the inputs visible see theprocedure on page1-14.
5-40 SIMATIC PCS 7 OSx 4.1.2 LibraryAdvanced Control Blocks
RATIO (Ratio Station) (continued)
Table 5-10 Output Table for RATIO
Element Description Type InitialValue
ENO Output valid BOOL 0
MASTER_GMAN Output for setting the master to manual BOOL 0
IMAN Loop in manual mode BOOL 0
IAUTO Loop in auto mode BOOL 0
ICASC Loop in cascade mode BOOL 0
SERR Sign error: 1 = --, 0 = + BOOL 0
INHHA Loop in high-high alarm: PV > HHA BOOL 0
INHA Loop in high alarm: PV > HA BOOL 0
INLA Loop in low alarm: PV < LA BOOL 0
INLLA Loop in low-low alarm: PV < LLA BOOL 0
INYDA Loop in yellow deviation alarm: ERR > ABS(YDA) BOOL 0
INODA Loop in orange deviation: ERR > ABS(ODA) BOOL 0
INRCA Loop in rate-of-change alarm BOOL 0
OVRUN Loop overrunning BOOL 0
SMODE Block status INT 0
ERR Loop error REAL 0.0
BIAS_O Loop bias output REAL 0.0
LPV Internal PV REAL 0.0
LSP Internal SP REAL 0.0
LMN Internal output REAL 0.0
RATIO_O Ratio of inputs REAL 0.0
6-1SIMATIC PCS 7 OSx 4.1.2 Library Other Control Blocks
Chapter 6
Other Control Blocks
6.1 Understanding Other Control Blocks 6-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2 ARWPC (Anti-Reset Windup Protection/Constraint Type) 6-3. . . . . . . . . . . . . . . . . . . . . . . . . .
6.3 ARWPS (Anti-Reset Windup Protection/Select Type) 6-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4 CORLT (Correlated Lookup Table) 6-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-2 SIMATIC PCS 7 OSx 4.1.2 LibraryOther Control Blocks
6.1 Understanding Other Control Blocks
The OSx Library provides several other function blocks that are available incontinuous function charts.
• Anti-reset windup protection blocks allow you to monitor a variable andprovide reset windup protection in addition to that provided by the PIDblock.
• The correlated lookup table determines an output value based on therelationship between an input and two 11-element arrays.
These function blocks must be activated with an assignment statement thatsets the ENABL input to true. These blocks can also be enabled from anassignment statement in an SFC step.
To deactivate the block set the ENABL input to false or the RDIS input totrue.
These control blocks have a Boolean input NRDY that you can use tointerlock the execution of the block to some external conditions.
• If you set the NRDY input to true, the block is forced to the disabledstate.
• To return the block to the enabled state you must not only set the NRDYinput to false, but you must also re-enable the block with anassignment statement.
The ENABL input for the dynamic blocks maps to a DO tag in OSx. You canuse this input to enable or disable the block in OSx. To command the blockfrom a DDO in OSx, you enter 0x8000 in the Command field to enable theblock and 0x0000 to disable.
Overview
Enabling andDisabling Blocks
6-3SIMATIC PCS 7 OSx 4.1.2 Library Other Control Blocks
6.2 ARWPC (Anti-Reset Windup Protection/Constraint Type)
The ARWPC function block (FB427) protects the integral mode of an OSxPID loop from windup by ensuring that a monitored variable remainswithin specified limits. The following OSx function blocks can be protected:PID, DTC, DMD, FFOA, FFSA, and RATIO.
This block can be used when constraints within the control loop can bereached without being detected by the anti-reset windup protection that isinternal to the PID block. This block is useful when you have two cascadedloops and the output of the source loop is greater than the output of thesecond loop.
The input to the block is the real value that you want to monitor.
When the protected loop is in automatic or cascade mode and the constraintblock is enabled, the ARWPC block compares the monitored variable (input)with the high and low limits that you specify when you define the constraintblock.
For a detailed explanation of the function of the AWS input for a loop, seepage 3-21. The ARWPC block freezes the bias (the integral term) of theprotected loop as follows:
• If the monitored variable is within the limits, the current value of theloop bias BIAS is stored internally; and the AWS (anti-windup status)input is set to 0 to indicate normal loop operation.
• If the monitored variable goes below the value of the LLIM (low limit)input while the loop is still trying to decrease the output, the constraintblock freezes the loop bias at the last recorded value; and the AWS loopinput is set to 1.
• If the monitored variable exceeds the value of the HLIM (high limit)input while the loop is still trying to increase the output, the constraintblock freezes the loop bias at the last recorded value before theconstraint was exceeded; and the AWS loop input is set to 2.
• To stop the integral mode from operating, assign 3 to the AWS loopinput.
NOTE: If the PID loop executes faster than the ARWPC function block,then the function block cannot protect the loop from windup. In this case,you must write code in the associated math section of the PID to provide thewindup protection.
Overview
6-4 SIMATIC PCS 7 OSx 4.1.2 LibraryOther Control Blocks
ARWPC (Anti-Reset Windup Protection/Constraint Type) (continued)
When you configure the ARWPC block, you must specify the data instanceof the protected function block in the P_OBJ input. To get the data instanceof the protected block, follow the steps below:
1. Double-click on the block to display the Block Object Properties dialogbox of the block that you want to protect.
2. Note the data instance in the General Properties folder. For example,the data instance for a PID loop might be DB14. If so, set the value ofthe P_OBJ input to 14.
When you enable the ARWPC block, the data instance specified in P_OBJ isexamined. If the ARWPC block determines that the instance belongs to avalid OSx loop block, the block is protected. The following ARWPC outputsare set if a valid instance is specified:
ENO = 1
ERROR = 16#0000
BLK_TYP = The protected object type. Valid protected object types arePID, DTC, DMD, FFO, FFS, and RATIO. If none of these block typesare recognized by the block, this output displays ’Unknown’.
If you have specified an invalid instance, ENO is 0, and an error code isreturned in the ERROR output. Table 6-1 lists the error codes for theARWPC function block. Once the error is corrected, ENO is set to 1.
Table 6-1 ARWPC Error Codes
Error Code Description
16#0001 Could not verify the OSx object signature.
16#80A1 The instance number is either 0 or greater than the maximumallowed for the controller.
16#80B1 The instance does not exist in the CPU.
16#80B2 The instance was created using the keyword UNLINKED.
Protecting a Loop
6-5SIMATIC PCS 7 OSx 4.1.2 Library Other Control Blocks
If you add or delete blocks, or do a compress function, the data instanceassigned to the protected function block could change. You must reset theP_OBJ input according to the procedure above.
The ARWPC block can only verify that it is connected to an OSx blockinstance; it cannot guarantee that it is protecting the correct instance. Forexample, if you have two blocks with loops, one in DB15 and one in DB16,the ARWPC cannot tell the difference; it protects the one specified byP_OBJ. The ARWPC block also cannot detect if another ARWPC or ARWPSblock is protecting the same loop.
! WARNINGThe ARWPC block can only protect the OSx loop instance that you specify inthe P_OBJ input. If the correct loop instance is not specified in the P_OBJ inputof the ARWPC block, the loop is unprotected, which can lead to unpredictablecontroller operations.
Unpredictable controller operations can result in death or serious injury topersonnel, and/or damage to equipment.
Be sure that you have specified the valid block instance that you want toprotect in the P_OBJ input.
6-6 SIMATIC PCS 7 OSx 4.1.2 LibraryOther Control Blocks
ARWPC (Anti-Reset Windup Protection/Constraint Type) (continued)
When you use an ARWPC block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• TEST_DB (SFC24)
The ARWPC function block is shown in Figure 6-1, and its inputs andoutputs are described in Table 6-2 and Table 6-3.
OB351
BO EN
BO REN
BO RDIS
BO ENABL
BO NRDY
Arw_6
ARWPC
ENO BO
ERROR W
BLK_TYP SN
1
0
0
0
Anti--Reset Windup Protect
I P_OBJ
R MV
0
0.0
0.0 R LLIM
1.0 R HLIM
0
Figure 6-1 ARWPC Block
Required Blocks
The ARWPC Block
6-7SIMATIC PCS 7 OSx 4.1.2 Library Other Control Blocks
Table 6-2 Input Table for ARWPC
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Block enable BOOL 0
NRDY Block not ready BOOL 0
P_OBJ Instance number of the protected block INT 0
MV Monitored variable REAL 0.0
HLIM High limit REAL 1.0
LLIM Low limit REAL 0.0
Table 6-3 Output Table for ARWPC
Element Description Type InitialValue
ENO Output valid BOOL 0
ERROR Error code WORD 0.0
BLK_TYP * Block type under proctection STRING ’ ’
* Valid protected object types are PID, DTC, DMD, FFO, FFS, and RATIO. If none of these block types arerecognized by the block, this output displays ’Unknown’.
6-8 SIMATIC PCS 7 OSx 4.1.2 LibraryOther Control Blocks
6.3 ARWPS (Anti-Reset Windup Protection/Select Type)
The ARWPS function block (FB428) protects the integral mode of a PID loopfrom windup by ensuring that the output of the PID loop remains equal tothe value of a monitored variable. The following function blocks can beprotected: PID, DTC, DMD, FFOA, FFSA, and RATIO.
This function block can be used when a PID loop does not have a direct pathto the controlled variable. For example, if you have a selector blockmonitoring the output of two PID blocks, you can use two select typeanti-reset windup blocks to compare the output of the selector block witheach PID output.
The input to the block is a real value that you want to monitor.
When the protected PID loop is in automatic or cascade mode and the selectblock is enabled, the block compares the monitored variable (input) to theoutput of the loop that you specify.
For a detailed explanation of the function of the AWS input for a loop, seepage 3-21. The block freezes the bias (the integral term) of the protectedPID as follows:
• If the monitored variable and output do agree, the current value of theloop bias BIAS input is stored internally; and the AWS loop anti-windupstatus input is set to 0 to indicate normal loop operation.
NOTE: You cannot use the ARWPS block to protect a loop configured to usethe velocity algorithm. This configuration causes the loop output LMN tofluctuate around the deadband and the AWS input of the loop to togglebetween 0 and 3.
• If the monitored variable and output do not agree, the select block setsthe loop bias equal to the monitored variable; and the loop AWS input isset to 3.
NOTE: If the PID loop executes faster than the ARWPS function block, thenthe function block cannot protect the loop from windup. In this case, youmust write code in the associated math section of the PID to provide thewindup protection.
Overview
6-9SIMATIC PCS 7 OSx 4.1.2 Library Other Control Blocks
When you configure the ARWPS block, you must specify the data instance ofthe protected function block in the P_OBJ input. To get the data instance ofthe protected block, follow the steps below:
1. Double-click on the block to display the Block Object Properties dialogbox of the block that you want to protect.
2. Note the data instance in the General Properties folder. For example,the data instance for a PID loop might be DB14. If so, set the value ofthe P_OBJ input to 14.
When you enable the ARWPS block, the data instance specified in P_OBJ isexamined. If the ARWPS block determines that the instance belongs to avalid OSx block, the block is protected. The following ARWPS outputs areset if a valid instance is specified:
ENO = 1
ERROR = 16#0000
BLK_TYP = The protected object type. Valid protected object types arePID, DTC, DMD, FFO, FFS, and RATIO. If none of these block typesare recognized by the block, this output displays ’Unknown’.
If you have specified an invalid instance, ENO is 0, and an error code isreturned in the ERROR output. Table 6-4 lists the error codes for theARWPS function block. Once the error is corrected, ENO is set to 1.
Table 6-4 ARWPS Error Codes
Error Code Description
16#0001 Could not verify the OSx object signature.
16#80A1 The instance number is either 0 or greater than the maximumallowed for the controller.
16#80B1 The instance does not exist in the CPU.
16#80B2 The instance was created using the keyword UNLINKED.
Protecting a Loop
6-10 SIMATIC PCS 7 OSx 4.1.2 LibraryOther Control Blocks
ARWPS (Anti-Reset Windup Protection/Select Type) (continued)
If you add or delete blocks, or do a compress function, the data instanceassigned to the protected function block could change. You must reset theP_OBJ input according to the procedure above.
The ARWPS block can only verify that it is connected to an OSx blockinstance; it cannot guarantee that it is protecting the correct instance. Forexample, if you have two blocks with loops, one in DB15 and one in DB16,the ARWPS cannot tell the difference; it protects the one specified by P_OBJ.The ARWPS block also cannot detect if another ARWPC or ARWPS block isprotecting the same loop.
! WARNINGThe ARWPS block can only protect the OSx loop instance that you specify inthe P_OBJ input. If the correct loop instance is not specified in the P_OBJ inputof the ARWPS block, the loop is unprotected, which can lead to unpredictablecontroller operations.
Unpredictable controller operations can result in death or serious injury topersonnel, and/or damage to equipment.
Be sure that you have specified the valid block instance that you want toprotect in the P_OBJ input.
6-11SIMATIC PCS 7 OSx 4.1.2 Library Other Control Blocks
When you use an ARWPS block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• TEST_DB (SFC24)
The ARWPS function block is shown in Figure 6-2, and its inputs andoutputs are described in Table 6-5 and Table 6-6.
OB351
BO EN
BO REN
BO RDIS
BO ENABL
BO NRDY
Arw_7
ARWPS
ENO BO
ERROR W
BLK_TYP SN
1
0
0
0
Anti--Reset Windup Protect
I P_OBJ
R MV
0
0.0
0
Figure 6-2 ARWPS Block
Required Blocks
The ARWPS Block
6-12 SIMATIC PCS 7 OSx 4.1.2 LibraryOther Control Blocks
ARWPS (Anti-Reset Windup Protection/Select Type) (continued)
Table 6-5 Input Table for ARWPS
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Block enable BOOL 0
NRDY Block not ready BOOL 0
P_OBJ Instance number of the protected block INT 0
MV Monitored variable REAL 0.0
Table 6-6 Output Table for ARWPS
Element Description Type InitialValue
ENO Output valid BOOL 0
ERROR Error code WORD 16#0
BLK_TYP * Block type under proctection. STRING ’ ’
* Valid protected object types are PID, DTC, DMD, FFO, FFS, and RATIO. If none of these block types arerecognized by the block, this output displays ’Unknown’.
6-13SIMATIC PCS 7 OSx 4.1.2 Library Other Control Blocks
6.4 CORLT (Correlated Lookup Table)
The CORLT function block (FB439) determines an output value based onthe relationship between an input value and a specified range of values.
Internally, two input arrays are used to perform the lookup. The values ofthese arrays are specified on an element-by-element basis on the blockinterface. By default, these element inputs are not visible, but can beaccessed in the Block Properties I/O folder. The values in the input arraymust be arranged in ascending order.
You can select a type of either lookup (LK_TYPE = 1) or interpolation(LK_TYPE = 0).
If you select lookup, the block compares the input value to the values in theinput array, in sequence. The block determines the value of the output withone of the following techniques:
• If the input value is equal to the value of an element of the input array,the output is assigned the value of the same element number in theoutput array.
• If the input value is not equal to the value of an element of the inputarray, the block uses the value of the highest element of the input arraythat is not greater than the input value. The output is assigned thevalue of the same element number in the output array.
• If the input value is less than the value of the first element of the inputarray, the output is assigned the value of the first element of the outputarray.
• If the input value is greater than the value of any element of the inputarray, the output is assigned the value of the last element of the outputarray.
Overview
BlockConfiguration
6-14 SIMATIC PCS 7 OSx 4.1.2 LibraryOther Control Blocks
Correlated Lookup Table (continued)
If you select interpolation, the block first compares the input value to thevalues in the input array. The block determines the value of the output withone of the following techniques:
• If the input value is equal to the value of an element of the input array,the output is assigned the value of the same element number in theoutput array.
• If the input value falls between the values of two elements of the inputarray, the output is assigned a value between the values of the sametwo element numbers in the output array. The value assigned to theoutput is interpolated between the values of the elements of the outputarray using the linear relationship calculated between the input valueand the values of the elements of the input array.
• If the input value is less than the value of the first element of the inputarray, the output is assigned a value less than the value of the firstelement of the output array. The value assigned to the output isextrapolated from the values of the first two elements of the outputarray using the linear relationship calculated between the input valueand the values of the first two elements of the input array.
• If the input value is greater than the value of the last element of theinput array, the output is assigned a value greater than the value of thelast element of the output array. The value assigned to the output isextrapolated from the values of the last two elements of the outputarray using the linear relationship calculated between the input valueand the values of the last two elements of the input array.
When you use a CORLT block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Required Blocks
6-15SIMATIC PCS 7 OSx 4.1.2 Library Other Control Blocks
The CORLT function block is shown in Figure 6-3, and its inputs andoutputs are described in Table 6-7 and Table 6-8.
OB351
BO EN
BO REN
BO RDIS
BO ENABL
BO NRDY
Corlt_1
CORLT
ENO BO
ENABLD BO
1
0
0
0
Correlated Lookup Table
BO LK_TYPE
R IN
1
0.0
0
OUT R
Figure 6-3 CORLT Block
The CORLT Block
6-16 SIMATIC PCS 7 OSx 4.1.2 LibraryOther Control Blocks
CORLT (Correlated Lookup Table) (continued)
Table 6-7 Input Table for CORLT
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Block enable BOOL 0
NRDY Block not ready BOOL 0
LK_TYPE Lookup algorithm type (1=Lookup, 0=Interpolation) INT 1
IN Input value REAL 0.0
Table 6-8 Output Table for CORLT
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Block is enabled BOOL 0
OUT Output value REAL 0.0
Understanding Devices 7-1SIMATIC PCS 7 OSx 4.1.2 Library
Chapter 7
Understanding Devices
7.1 Basic Operation of Devices 7-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Overview 7-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Device Types 7-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Controlling Devices from SFC 7-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2 Device Modes 7-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Manual Mode 7-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Auto Mode 7-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Changing Modes 7-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Changing States 7-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3 Device Feedback 7-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Override Inputs 7-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Reset Input 7-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Null Feedback 7-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Single Feedback 7-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Inverting Feedback Inputs 7-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Dual Feedback 7-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.4 User-defined Devices 7-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.5 Device Power-Fail Recovery 7-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Devices7-2 SIMATIC PCS 7 OSx 4.1.2 Library
7.1 Basic Operation of Devices
An OSx Library device is an object that uses a collection of I/O points tomonitor and manipulate a field device, such as a valve, motor, cylinder, orpress.
The device function blocks in the OSx Library are designed to provide thefull functionality of the APT device tags. Certain settings that are defined inspecial forms in APT, such as E_STATE and IGN_OVRD, are configured asinputs in the S7 function blocks.
For specific information about individual types of OSx Library devices, referto the following chapters :
• Valves — Chapter 8
• Motors — Chapter 10
• Cylinders — Chapter 11
• Presses — Chapter 12
Figure 7-1 shows how an OSx device interacts with S7 hardware andsoftware to control the physical device in your process.
Overview
Understanding Devices 7-3SIMATIC PCS 7 OSx 4.1.2 Library
CPU 400
V10_OC
V10_OLS
I/O Symbolic name: V10_OLSPhysical address: I17.0
I/O Symbolic name: V10_OCPhysical address: Q0.0
Symbol Address Data Type Comment
ADAPTER
ALARM_8P
ALARM_S
ASC_ONOF
ASC_PIDONOFF
PACKSTAT
PID
RBE_P
RBE_S
RD_SINFO
SFC_INTP
VSS
V10_OC
V10_OLS
393
3518
408
402401
930
400394
395
6
300
344
0.0
17.0
FB
SFBSFC
FB
FBFB
FC
FB
FB
FB
SFC
FB
FB
Q
I
BOOL
BOOL
393
3518
408
402401
930
400394
395
6
300
344
FB
SFBSFC
FB
FBFB
FC
FB
FB
FB
SFC
FB
FB
Call an indirectly addressed FB
ON/OFF control block
PACK status information
PID control block
Report by exception using ALARM_8P
Report by exception using ALARM_S
Read Start information
SFC1--Ablaufsystem
Single Drive/Single Feedback Valve
Valve V10 output control
Valve V10 open limit switch
Symbol Table
V10_OLSI17.0 Valve V10 open limit switch
V10_OCQ0.0 Valve V10 output control
V10VSSH20 valve #10
CMMD BOBO OCLS
1
0
0000000
000
0.11.01.0
1000
CFC
Figure 7-1 Connecting an OSx Device to Your Process
Understanding Devices7-4 SIMATIC PCS 7 OSx 4.1.2 Library
Basic Operation of Devices (continued)
Table 7-1 lists characteristics of the OSx Library devices provided by thesystem. If none of these devices fit your application, you can create yourown, using the user-defined devices coupled with your own external logic.
Table 7-1 OSx Library Devices
Device Type Device Code De-energizedState
Valves
Hand Valve/Dual-Feedback VND N/A
Single-Drive/Null-Feedback (Energize Open) E_STATE=1 VSN (Type O) ClosedSingle-Drive/Null-Feedback (Energize Closed) E_STATE=0 VSN (Type C) OpenSingle-Drive/Single-Feedback (Energize Open) E_STATE=1 VSS (Type O) Closed
Single-Drive/Single-Feedback (Energize Closed) E_STATE=0 VSS (Type C) OpenSingle-Drive/Dual-Feedback (Energize Open) E_STATE=1 VSD (Type O) ClosedSingle-Drive/Dual-Feedback (Energize Closed) E_STATE=0 VSD (Type C) Open
Dual-Drive/Dual-Feedback VDD ClosedMotor-Drive/Dual-Feedback VMD ClosedThree-Position Low/High/Dual-Feedback BV1 ClosedThree-Position Open/Position/Dual-Feedback BV2 Closed
User-defined VUD User-defined
Motors
Single-Drive/Null-Feedback MSN StoppedSingle-Drive/Single-Feedback MSS StoppedDual-Drive/Null-Feedback MDN StoppedDual-Drive/Single-Feedback MDS StoppedReversible Forward/Reverse/Dual-Feedback RM1 Stopped
Reversible Drive/Direction/Dual-Feedback RM2 StoppedTwo-Speed Low/High/Dual-Feedback TS1 Stopped
Two-Speed Drive/Speed/Dual-Feedback TS2 StoppedUser-defined MUD User-defined
Cylinder
Single-Drive/Dual-Feedback (Energize Extend) E_STATE=1 CSD Retracted
Single-Drive/Dual-Feedback (Energize Retract) E_STATE=0 CSD ExtendedUser-defined CUD User-defined
Table continues on next page.
Device Types
Understanding Devices 7-5SIMATIC PCS 7 OSx 4.1.2 Library
Table 7-1 OSx Library Devices (continued)
Device Type Device Code De-energizedState
Press
Hand Press/Dual-Feedback PND N/A
Single-Drive/Null-Feedback (Energize Raise) E_STATE=1 PSN DownSingle-Drive/Null-Feedback (Energize Lower) E_STATE=0 PSN UpSingle-Drive/Single-Feedback (Energize Raise) E_STATE=1 PSS DownSingle-Drive/Single-Feedback (Energize Lower) E_STATE=0 PSS Up
Single-Drive/Dual-Feedback (Energize Raise) E_STATE=1 PSD DownSingle-Drive/Dual-Feedback (Energize Lower) E_STATE=0 PSD UpDual-Drive/Dual-Feedback PDD DownMotor-Drive/Dual-Feedback PMD DownThree-Position Low/High/Dual-Feedback PS1 DownThree-Position Raise/Position/Dual-Feedback PS2 Down
User-defined PUD User-defined
Understanding Devices7-6 SIMATIC PCS 7 OSx 4.1.2 Library
Basic Operation of Devices (continued)
You can manipulate devices from the SFC by changing the state of devicerequest inputs to true. When the device executes, the request inputs are setback to false. Figure 7-2 shows an example of how you can control a devicefrom the SFC.
S1
S2
T1
CFC1\V10.RTO:=TRUE
CFC Name Valve Name Request-to-Open Input
CFC1\V10.OPND=TRUE
CFC Name Valve Name Open-Status Output
Figure 7-2 Controlling Devices from SFC
Controlling Devicesfrom SFC
Understanding Devices 7-7SIMATIC PCS 7 OSx 4.1.2 Library
7.2 Device Modes
OSx Library valves, motors, cylinders, and presses have two basic modes ofoperation.
• Manual mode indicates that a field device can be controlled by anoperator.
• Auto mode indicates that the field device is under the control of thecontroller from a Sequential Function Chart, or from a ContinuousFunction Chart object.
Request inputs (such as RTO and RTC) are provided to manipulate the fielddevices in auto mode. These requests have no effect in manual mode. TheOSx Library devices also provide inputs (MOPEN, MSTRT, MEXTEND, andMRAISE) that are used to monitor and control the field devices. In automode, request inputs take precedence over assignments made to theseinputs.
NOTE: The request inputs should not be manipulated in the processingsection of an SFC step, since the CMMD output could be set to true duringthe entire execution of the step. The request inputs are not automaticallyset to false until the step is complete.
Understanding Devices7-8 SIMATIC PCS 7 OSx 4.1.2 Library
Device Modes (continued)
A field device is in manual mode whenever the LOCKD input for that deviceis false. When the program is first downloaded to the controller, all devicesare in manual mode and set to the de-energized state, which is listed inTable 7-1.
After the program is in the controller, the following conditions can also placea field device in manual mode.
• The DSBLD input for that device is set to true.
• An RTU (request to unlock) for that device is set to true.
A device remains in manual mode until an RTL (request to lock) that is setto true places the device in auto mode. However, any one of the aboveconditions takes precedence over an RTL (request to lock) and prevents theobject from leaving manual mode.
In manual mode, an operator can control a device by toggling the operationinputs (the MOPEN input for valves, MSTRT for motors, MEXTEND forcylinders, and MRAISE for presses). These inputs can also be manipulatedfrom within a CFC or an SFC step.
• To open (start, extend, raise) the device, set the MOPEN (MSTRT,MEXTEND, or MRAISE) input to true.
• To close (stop, retract, lower) the device, set the MOPEN (MSTRT,MEXTEND, or MRAISE) input to false.
Request inputs (such as RTO and RTC) have no effect in manual mode.
Manual Mode
Understanding Devices 7-9SIMATIC PCS 7 OSx 4.1.2 Library
A field device is in auto, or locked, mode whenever the LOCKD input is true.Setting RTL to true places the device in auto mode if no manual-modeconditions exist (page 7-8). After the device enters auto mode, it remainsthat way until any one of the conditions that place the device in manualmode becomes true.
Request inputs are automatically set to false after execution of a block.
Table 7-2 shows the APT commands that control the state of a device in automode and the inputs that you must set to initiate those actions.
Table 7-2 Controlling Devices in Auto Mode
Device APT Commands Request Inputs
Valve open/close RTO/RTC
Motor start/stop RTR/RTS
Cylinder extend/retract RTE/RTR
Press raise/lower RTO/RTC
Avoid issuing conflicting request inputs simultaneously. If you initiate openand close (RTO/RTC), start and stop (RTR/RTS), extend and retract(RTE/RTR), or raise and lower (RTO/RTC) requests simultaneously, therequest that takes the device to its de-energized state takes precedence overthe request that moves it away from the de-energized state.
While a field device is in auto mode, the MOPEN (MSTRT, MEXTEND, andMRAISE) input follows the desired state. If the desired state is open(running, extended, raised), MOPEN (MSTRT, MEXTEND, MRAISE) is set totrue; otherwise, MOPEN (MSTRT, MEXTEND, MRAISE) is set to false. While inauto mode, the MOPEN (MSTRT, MEXTEND, MRAISE) input cannot be changedmanually.
Auto Mode
Understanding Devices7-10 SIMATIC PCS 7 OSx 4.1.2 Library
Device Modes (continued)
When a field device is switched from manual mode to auto mode, the devicemaintains the state that existed before the mode change. For example, if avalve is open, it remains open to provide a bumpless transfer. If the valve isin a traveling state, it remains in that state and continues toward the statethat was requested before the mode change.
If RTL is set to initiate a lock action at the same time that themanual-control operation input (MOPEN/MSTRT/MEXTEND/MRAISE) istoggled, the device enters auto mode before the change is noticed. As aresult, the device does not change state; and the desired state is the same asit was before you requested the mode change.
The way the device behaves when switching from auto to manual modedepends on how the MOPEN/MSTRT/MEXTEND/MRAISE input is controlled.
• If the input is controlled from an operator station that does notcontinuously write to the input, switching from locked to manual modeis identical to switching from manual to locked mode. (The devicemaintains the state that existed before the mode change).
• If the input is controlled directly by a switch or push button, the devicemay begin traveling to a new state if the state indicated by the MOPEN(MSTRT, MEXTEND, MRAISE) input is not the same as the current stateof the device.
If an unlock (RTU) and an open (start/extend/raise) or a close(stop/retract/lower) action are initiated simultaneously by setting theappropriate input, the device enters manual mode before the request toopen or close is processed; as a result, the device does not change state.
Figure 7-3 shows the inputs that determine the mode of a device.
Auto Mode
Lock
DSBLD=true
Unlock
Manual ModeMOPEN (MSTRT, MEXTEND, MRAISE)
CMMD
RTO/RTC,(RTR/RTSRTE./RTR,RTO/RTC)
CMMD
MOPEN (MSTRT,MEXTEND, MRAISE) RTL=true
RTU=true
Figure 7-3 Manual and Auto Modes
Changing Modes
Understanding Devices 7-11SIMATIC PCS 7 OSx 4.1.2 Library
There are two cases when a device can change state without operator action.
• If the NRDY input becomes true, the device is forced to the de-energizedstate and the MOPEN (MSTRT, MEXTEND, MRAISE) input shows thecorresponding de-energized-state value.
Assignment statements that attempt to change the MOPEN (MSTRT,MEXTEND, MRAISE) input and move the device away from itsde-energized state are overridden while the NRDY input is true.
When NRDY returns to false, the device remains in its de-energizedstate until it receives a request to change.
• The second special case is when the power to the controller fails. In thiscase, the device behaves exactly as if the NRDY input were true duringthe power loss and returns to false when the power returns. SeeSection 7.5 for more information.
Changing States
Understanding Devices7-12 SIMATIC PCS 7 OSx 4.1.2 Library
7.3 Device Feedback
OSx Library devices have feedback inputs that indicate that the device hasreached the required state or position. A device has either no feedbackinputs (null feedback, page 7-13), one feedback input (single feedback,page 7-14), or two feedback inputs (dual feedback, page 7-16).
Devices with feedback have override inputs that allow you to ignore thefeedback status.
• Single-feedback devices have one override input (OVRD).
• Dual-feedback valves have two override inputs (OVRDO and OVRDC).
• Batch values have two override inputs (OVRDH and OVRDL).
• Reversible and two-speed motors each have two override inputs(OVRDF/OVRDR and OVRDL/OVRDH).
• Dual feedback cylinders have two override inputs (OVRDE and OVRDR).
• Dual feedback presses have two override inputs (OVRDU and OVRDD).
• Three-position presses have two override inputs (OVRDH and OVRDL).
If an override input is true, the corresponding feedback input is ignored.The TRVL output operates like the null feedback device when the overrideinput is true.
The RESET input is set back to false after execution of the block. When theRESET input goes to true, the override inputs are set to false, and the alarmtimers are reset. The RESET input is automatically set back to false.
If the feedback is not indicating the requested state, then the TRVL outputbecomes true and the alarm timer begins timing down. From this point, thestate of the device depends on the feedback inputs.
NOTE: The RESET input should not be manipulated in the processingsection of an SFC step, since the CMMD output can be set to true during theentire execution of the step. The RESET input is not automatically set tofalse until the step is complete.
Override Inputs
Reset Input
Understanding Devices 7-13SIMATIC PCS 7 OSx 4.1.2 Library
A null feedback device provides no indication that the device has actuallyreached the desired state or position, but assumes the desired state hasbeen reached after the specified alarm timer expires.
The desired position is determined by the MOPEN (MSTRT, MEXTEND,MRAISE) input in manual mode or by the request inputs RTO/RTC (RTR/RTS,RTE/RTR) in auto mode.
Whenever the desired state of a null feedback device changes or thecontroller returns from a power loss, the TRVL output for that devicebecomes true and the alarm timer begins timing down.
When the alarm time elapses, the TRVL output becomes false and the outputthat indicates the desired position becomes true: either OPND or CLSD(correspondingly, either RUNNG or STPPD, EXTENDED or RETRACTED, UP orDOWN). That output then remains true until either the desired statechanges or the controller loses power.
Null Feedback
Understanding Devices7-14 SIMATIC PCS 7 OSx 4.1.2 Library
Device Feedback (continued)
A single-feedback device has one input that indicates whether or not thedevice has actually reached the desired state or position. This feedbackinput is OCLS for valves, RUNIO for motors, and UDLS for presses.
A feedback is expected to be true when the device is in its energized state;otherwise, it is false.
Whenever the desired state of a single-feedback device changes or thecontroller returns from a power loss, the TRVL output becomes true and thealarm timer begins timing down. From this point, the behavior of the devicedepends on the state of the override (OVRD) input.
Override input false. If OVRD is false, the following actions occur.
• If the feedback input indicates that the device is in the desired state,the appropriate position or state output listed below is true:
Device Position or State Output
Valve OPND CLSD
Motor RUNNG STPPD
Press UP DOWN
• If the alarm timer has expired and the feedback input indicates thatthe device is not in the desired state, the appropriate fail output listedbelow is true:
Device Fail Output
Valve FTO FTC
Motor FTR FTS
Press FTR FTL
• If the alarm timer has not expired and the feedback input is false, theTRVL output is true.
Single Feedback
Understanding Devices 7-15SIMATIC PCS 7 OSx 4.1.2 Library
Override input true. If OVRD is true, the feedback input is ignored, andthe device operates like a null-feedback device.
When the SFC step or CFC object that contains the RESET input is active,the OVRD input is forced to false; attempts to change this input to true areoverwritten.
When the SFC step or CFC object that contains the RESET input becomesinactive, the OVRD input remains false until changed by an operator or bythe program.
Feedback inputs are normally-closed elements. You can invert them to makethem normally-open inputs. Follow the procedure on page 1-16.
Inverting FeedbackInputs
Understanding Devices7-16 SIMATIC PCS 7 OSx 4.1.2 Library
Device Feedback (continued)
A dual-feedback device has two inputs that indicate whether or not thedevice has actually reached the desired state or position. Dual-feedbackdevices use the following feedback inputs:
Device Feedback Inputs
Valve OLS CLS
Batch Valve HIO LIO
Reversible Motor FIO RIO
Two-Speed Motor LIO HIO
Cylinder ELS RLS
Press ULS DLS
Three-Position Press HIO LIO
Whenever the desired state of a device changes or the controller returnsfrom a power loss, the TRVL output becomes true, and the alarm time beginstiming down. From this point, the behavior of the device depends on thestate of the following override inputs:
Device Override Inputs
Valve OVRDO OVRDC
Batch Valve OVRDH OVRDL
Reversible Motor OVRDF OVRDR
Two-Speed Motor OVRDL OVRDH
Cylinder OVRDE OVRDR
Press OVRDU OVRDD
Three-Position Press OVRDH OVRDL
Both override inputs false. If both override inputs are false, thefollowing actions occur.
• If the appropriate feedback input for the required position is true, thecorresponding position or state output listed below is true:
Device Position or State Output
Valve OPND CLSD
Batch Valve OPNDH OPNDL
Reversible Motor RUNF RUNR
Two-Speed Motor RUNL RUNH
Cylinder EXTENDED RETRACTED
Press UP DOWN
Three-Position Press UPH UPL
Dual Feedback
Understanding Devices 7-17SIMATIC PCS 7 OSx 4.1.2 Library
• If the alarm timer has expired and the appropriate feedback input forthe desired position is false, the corresponding fail output listed belowis true:
Device Fail Output
Valve FTO FTC
Batch Valve FTOH FTOL
Reversible Motor FTRF FTRR
Two-Speed Motor FTRL FTRH
Cylinder FTE FTR
Press FTR FTL
Three-Position Press FTRH FTRL
• If the alarm timer has expired and both feedback inputs are true, theFAILD output is true.
• If the alarm timer has not expired and neither feedback input is in thedesired state, the TRVL output is true.
Either override input true. If either override is true, the state that isoverridden acts like a null-feedback device.
Both override inputs true. If both overrides are true, the feedbackinputs are ignored, and the device operates like a null-feedback device.
In switching the override inputs between states, the position and failoutputs assume whatever status is correct for the current state of therequest and feedback inputs.
When the SFC step or CFC object that contains the RESET input is active,the override inputs are forced to false; attempts to change these inputs totrue are overwritten. When the SFC step or CFC object that contains theRESET input becomes inactive, the overrides remain false until changed byan operator or by the program.
Understanding Devices7-18 SIMATIC PCS 7 OSx 4.1.2 Library
7.4 User-defined Devices
The user-defined devices for valves (VUD), motors (MUD), cylinders (CUD),and presses (PUD) are provided so that you can create your own controllogic for a device and use it in OSx. You can create this logic either in SCLor in the ladder editor in STEP 7, and then import it into CFC as an object.
In the CFC chart, you must pull both the user-defined device function blockand your custom object onto the chart and interconnect them, as shown inthe example in Figure 7-4. The combination of the user-defined device andyour custom object results in a new device that is recognized by the OSxstations as an vlv2 type of object.
The user-defined devices contain many inputs and outputs to ensureflexibility. In order to simplify the connection to your custom object and tokeep down the number of lines in the CFC, make any unused inputs andoutputs not visible (see page 1-14).
Understanding Devices 7-19SIMATIC PCS 7 OSx 4.1.2 Library
ENO BOMOPEN O BOOFEED O BOC FEED O BO
RTL O BORTU O BORTO O BORTC O BO
2
OB351
BO EN
VUD1VUD
ENO BO1
User Defined
R SAMPLE_T
BO OLSBO CLS
BO DSBLD
BO NRDY
BO RTLBO RTU
BO RTC
R O_ALRM_TR C_ALRM_T
BO LOCKD
CMMD BOOPND BOCLSD BOTRVL BOFTO BO
0.11.0
FTC BO
1.0
O_CUR_T RC_CUR_T R
BO RTO
BO MOPEN
OB35
BO EN
vudctrlCUSTOM1
1
BO TRAVL I
I RAMP1
I RAMP2I TORQUE
BO FTC I
BO OPENBO CLOSE
BO UNLOCK
BO FTO I
00
BO LOCK
0
BO JOG
2
Figure 7-4 Example Control Logic for User-defined Devices
Understanding Devices7-20 SIMATIC PCS 7 OSx 4.1.2 Library
7.5 Device Power-Fail Recovery
Upon return from a power failure, the S7 controller executes one of thefolowing restart organization blocks (OBs):
• OB100 -- Warm restart
• OB101 -- Hot restart (not available on 417H)
• OB102 -- Cold restart
• OB105 -- Standby startup (417H only)
By default, the devices have OB100 added to their task lists so that they arecalled on restart as well as from the user-specified cyclic OB.
The device detects when it has been called from a start-up OB and thendetermines if the last controller state was power failure or program mode. Ifthe previous controller state was power failure, then the device goes to itsde-energized state.
If you want power-fail processing to be invoked from any of the restart OBsinstead of or in addition to OB100, open the CFC and follow these steps:
1. Right-click on the name of the device and select Go to Installed Position.The run-time editor starts.
2. Click the plus sign (+) to the left of the cyclic OB in which the device isinstalled, such as OB32 or OB35.
3. Right-click on the device name and select Copy.
4. Right-click on the restart OB (such as OB101) that you want to use forthe device and select Insert. The device is added to the list for the newrestart OB.
5. Repeat step 3 for all the restart OBs from which you want to have thedevice called.
Understanding Devices 7-21SIMATIC PCS 7 OSx 4.1.2 Library
If you do not want power-fail processing for your devices, delete anyreferences to the device from OB100 through OB105. Open the CFC andfollow these steps:
1. Right-click on the name of the device and select Go to Installed Position.The run-time editor starts.
2. Click the plus sign (+) to the left of OB100 in the list to expand it.
3. Right-click on the device name in the expanded OB100 list to highlightit.
4. Click the Delete button. The device is removed from the OB100 list.
5. Repeat steps 2 through 4 for the other restart OBs. Press OK when youare finished.
The OSx Library does not contain power-fail recovery logic for user-definedor hand-operated devices. If your process requires power-fail recovery logic,you can write code based on the Boolean extensions.
NOTE: The battery backup on your S7 controller must be enabled in orderfor the controller to save data during a power failure.
Understanding Devices7-22 SIMATIC PCS 7 OSx 4.1.2 Library
8-1SIMATIC PCS 7 OSx 4.1.2 Library Valves
Chapter 8
Valves
8.1 Valve Inputs and Outputs 8-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2 VND (Hand-Operated/Dual-Feedback Valve) 8-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.3 VSN (Single-Drive/Null-Feedback Valve) 8-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.4 VSS (Single-Drive/Single-Feedback Valve) 8-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.5 VSD (Single-Drive/Dual-Feedback Valve) 8-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.6 VDD (Dual-Drive/Dual-Feedback Valve) 8-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.7 VMD (Motor-Drive/Dual-Feedback Valve) 8-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.8 VUD (User-defined Valve) 8-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.9 BV1 (Three-Position Valve/Type 1) 8-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.10 BV2 (Three-Position Valve/Type 2) 8-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8-2 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
8.1 Valve Inputs and Outputs
Table 8-1 and Table 8-2 list the input and output elements for valve devicesand show the types of valves that use each element.
Table 8-1 Valve Inputs
Element Description Valve Types
EN Enable VND VSN VSS VSD VDD VMD BV1/2 VUD
OCLS Open/closed feedback VSS
OLS Open feedback VND VSD VDD VMD VUD
CLS Closed feedback VND VSD VDD VMD VUD
HIO Open high feedback BV1/2
LIO Open low feedback BV1/2
RTL Request to lock (place in automode) VSN VSS VSD VDD VMD BV1/2 VUD
RTU Request to unlock (place inmanual mode) VSN VSS VSD VDD VMD BV1/2 VUD
RTO Request to open valve VSN VSS VSD VDD VMD VUD
RTOA Request to open, option A VUD
RTOB Request to open, option B VUD
RHIGH Request to open high BV1/2 VUD
RLOW Request to open low BV1/2 VUD
RTC Request to close valve VSN VSS VSD VDD VMD BV1/2 VUD
RTS Request to stop the valvemotor VMD
RESET Clear feedback overrides VSS VSD VDD VMD BV1/2 VUD
MOPEN Manual open VND VSN VSS VSD VDD VMD BV1/2 VUD
MHIGH Manual high BV1/2
DSBLD Forced to manual mode VSN VSS VSD VDD VMD BV1/2 VUD
LOCKD Locked (auto mode) VSN VSS VSD VDD VMD BV1/2 VUD
NRDY Not ready VSN VSS VSD VDD VMD BV1/2 VUD
SAMPLE_T Sample time (in seconds) VSN VSS VSD VDD VMD BV1/2 VUD
O_ALRM_T Open alarm time (in seconds) VSN VSS VSD VDD VMD BV1/2 VUD
C_ALRM_T Close alarm time (in seconds) VSN VSS VSD VDD VMD BV1/2 VUD
E_STATE Energize state:1=open, 0=closed VSN VSS VSD
Table continues on next page.
8-3SIMATIC PCS 7 OSx 4.1.2 Library Valves
Table 8-1 Valve Inputs (continued)
Element Description Valve Types
OVRD Override feedback VSS
OVRDO Override open feedback VSD VDD VMD VUD
OVRDC Override closed feedback VSD VDD VMD VUD
OVRDH Override high, option Hfeedback BV1/2
OVRDL Override low, option L feedback BV1/2
IGN_OVRD Ignore feedback override VSS VSD VDD VMD BV1/2 VUD
CLR_CMMD Clear CMMD on FTO/FTC VSS VSD
SAME_FBK Same feedback (LIO=HIO) BV1/2
ORESET Open reset VUD
CRESET Close reset VUD
8-4 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
Valve Inputs and Outputs (continued)
Table 8-2 Valve Outputs
Element Description Valve Types
ENO Output valid VND VSN VSS VSD VDD VMD BV1/2 VUD
CMMD Open/close command VSN VSS VSD VDD VMD VUD
OPENC Open command VDD VMD VUD
CLSC Close command VDD VMD VUD
SHIGH Open high BV1
SLOW Open low BV1
DRV Open command BV2
POS Open position BV2
OPND Opened VND VSN VSS VSD VDD VMD BV1/2 VUD
OPNDA Opened option A VUD
OPNDB Opened option B VUD
OPNDH Opened high, option H BV1/2
OPNDL Opened low, option L BV1/2
CLSD Closed VND VSN VSS VSD VDD VMD BV1/2 VUD
TRVL Traveling VSN VSS VSD VDD VMD BV1/2 VUD
FTO Fail to open VSS VSD VDD VMD BV1/2 VUD
FTOH Fail to open high BV1/2
FTOL Fail to open low BV1/2
FTC Fail to close VSS VSD VDD VMD BV1/2 VUD
FAILD Failed VND VSD VDD VMD BV1/2 VUD
OPNTO Open timeout VDD VMD BV1/2 VUD
CLSTO Close timeout VDD VMD BV1/2 VUD
LOCKD_O Locked output VSN VSS VSD VDD VMD BV1/2 VUD
O_CUR_T Open current time (in seconds) VSN VSS VSD VDD VMD BV1/2 VUD
C_CUR_T Close current time (in seconds) VSN VSS VSD VDD VMD BV1/2 VUD
8-5SIMATIC PCS 7 OSx 4.1.2 Library Valves
8.2 VND (Hand-Operated/Dual-Feedback Valve)
The VND device (FB346) has two positions (open and closed) and iscontrolled by two discrete feedback signals.
The two feedback signals consist of an open feedback signal (OLS) and aclosed feedback signal (CLS).
• The OLS input is expected to be true when the valve is open and falsewhen it is closed.
• The CLS input is expected to be true when the valve is closed and falsewhen it is open.
The MOPEN element reflects the state of the valve as follows:
• If the valve is open (OLS=true), the control signal MOPEN is set to true.
• If the valve is closed (CLS=true), the control signal MOPEN is set tofalse.
When you use a VND device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
8-6 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VND (continued)
The VND function block is shown in Figure 8-1, and its inputs and outputsare described in Table 8-3 and Table 8-4.
1
0
0
valve_7
VNDHand Operated OB35
1
ENO BO
OPND BO
CLSD BO
FAILD BO
BO EN
BO OLS
BO CLS
MOPEN BO
Figure 8-1 VND Block
Table 8-3 Input Table for VND
Element Description Type InitialValue
EN Enable BOOL 1
OLS Open feedback BOOL 0
CLS Closed feedback BOOL 0
Table 8-4 Output Table for VND
Element Description Type InitialValue
ENO Output valid BOOL 0
MOPEN Manual open BOOL 0
OPND Valve opened BOOL 0
CLSD Valve closed BOOL 0
FAILD Valve failed BOOL 0
The VND Block
8-7SIMATIC PCS 7 OSx 4.1.2 Library Valves
8.3 VSN (Single-Drive/Null-Feedback Valve)
The VSN device (FB347) has two positions (open and closed) and iscontrolled by one discrete signal with no feedback. Two types of VSN devicecontrol are available: energize-open and energize-closed. You can select thetype of VSN device control you want by setting the E_STATE input to 1(energize-open) or 0 (energize-closed). Energize-open is the default.
• If the desired state of an energize-open valve is open (MOPEN=true), thefield control signal CMMD is set to true.
If the desired state is closed (MOPEN=false), the CMMD output is set tofalse.
• If the desired state of an energize-closed valve is open (MOPEN=true),the control signal CMMD is set to false.
If the desired state is closed (MOPEN=false), the CMMD output is set totrue.
When you use a VSN device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
8-8 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VSN (continued)
The VSN function block is shown in Figure 8-2, and its inputs and outputsare described in Table 8-5 and Table 8-6.
1
1
0.1
0
0
0
0
0
0
1.0
1.0
0
valve_13
VSNSingle-Drive/N OB35
1
ENO BO
CMMD BO
OPND BO
CLSD BO
TRVL BO
O_CUR_T R
BO EN
BO E_STATE
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTO
BO RTC
R C_ALRM_T
R O_ALRM_T
BO LOCKD
BO MOPEN0
C_CUR_T R
LOCKD_O BO
Figure 8-2 VSN Block
The VSN Block
8-9SIMATIC PCS 7 OSx 4.1.2 Library Valves
Table 8-5 Input Table for VSN
Element Description Type InitialValue
EN Enable BOOL 1
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to open valve BOOL 0
RTC Request to close valve BOOL 0
MOPEN Manual open BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
O_ALRM_T Open alarm time (in seconds) REAL 1.0
C_ALRM_T Close alarm time (in seconds) REAL 1.0
E_STATE Energize state: 1=open, 0=closed BOOL 1
Table 8-6 Output Table for VSN
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Open/close command BOOL 0
OPND Opened BOOL 0
CLSD Closed BOOL 0
TRVL Traveling BOOL 0
LOCKD_O Locked output BOOL 0
O_CUR_T Open current time (in seconds) REAL 0.0
C_CUR_T Close current time (in seconds) REAL 0.0
8-10 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
8.4 VSS (Single-Drive/Single-Feedback Valve)
The VSS device (FB344) has two positions (open and closed) and iscontrolled by a single discrete signal with one discrete feedback signal. Twotypes of VSS device control are available: energize-open and energize-closed.You can select the type of VSS device control you want by setting theE_STATE input to 1 (energize-open) or 0 (energize-closed). Energize-open isthe default.
• If the desired state of an energize-open valve is open (MOPEN=true), thecontrol signal CMMD is set to true. If the desired state is closed(MOPEN=false), the CMMD output is set to false.
The feedback signal for the energize-open valve (OCLS) is expected tobe true when the valve is open and false when the valve is closed.
• If the desired state of an energize-close valve is open (MOPEN=true), thecontrol signal CMMD is set to false. If the desired state is closed(MOPEN=false), the CMMD output is set to true.
The feedback signal for the energize-close valve (OCLS) is expected tobe false when the valve is open and true when the valve is closed.
• If the CLR_CMMD input is set to true, the CMMD output changes to falsewhen the FTO (for energize-open valves) or FTC (for energize-closedvalves) becomes true. The CMMD output remains false until RESET isset to true.
• The RESET input clears the OVRD input and resets the alarm timer.The alarm timer O_CUR_T or C_CUR_T starts counting down when theRESET input goes false. If the OCLS feedback does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRD input.
When you use a VSS device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
8-11SIMATIC PCS 7 OSx 4.1.2 Library Valves
The VSS function block is shown in Figure 8-3, and its inputs and outputsare described in Table 8-7 and Table 8-8.
OB351
BO EN
valve_6
VSS
ENO BO1
Single-Drive/S
BO IGN_OVRD
R SAMPLE_T
BO OCLS
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTO
BO RTC
BO RESET
R C_ALRM_T
R O_ALRM_T
BO LOCKD
BO MOPEN
BO OVRD
BO E_STATE
CMMD BO
OPND BO
CLSD BO
TRVL BO
FTO BO
FTC BO
O_CUR_T R
0
0
0
0
0
0
0
0
0.1
1.0
1.0
1
0
0
0
0
0
BO CLR_CMMD
C_CUR_T R
LOCKD_O BO
Figure 8-3 VSS Block
The VSS Block
8-12 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VSS (continued)
Table 8-7 Input Table for VSS
Element Description Type InitialValue
EN Enable BOOL 1
OCLS Feedback input (open/close) BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to open valve BOOL 0
RTC Request to close valve BOOL 0
RESET Clear feedback override BOOL 0
MOPEN Manual open BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
O_ALRM_T Open alarm time (in seconds) REAL 1.0
C_ALRM_T Close alarm time (in seconds) REAL 1.0
E_STATE Energize state: 1=open, 0=closed BOOL 1
OVRD Override feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
CLR_CMMD Clear CMMD on FTO/FTC BOOL 0
8-13SIMATIC PCS 7 OSx 4.1.2 Library Valves
Table 8-8 Output Table for VSS
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Open/close command BOOL 0
OPND Opened BOOL 0
CLSD Closed BOOL 0
TRVL Traveling BOOL 0
FTO Fail to open BOOL 0
FTC Fail to close BOOL 0
LOCKD_O Locked output BOOL 0
O_CUR_T Open current time (in seconds) REAL 0.0
C_CUR_T Close current time (in seconds) REAL 0.0
8-14 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
8.5 VSD (Single-Drive/Dual-Feedback Valve)
The VSD device (FB345) has two positions (open and closed) and iscontrolled by a single discrete signal with two discrete feedback signals. Twotypes of VSD devices are supported: energize-open and energize-closed. Youcan select the type of VSD device control you want by setting the E_STATEinput to 1 (energize-open) or 0 (energize-closed). Energize-open is thedefault.
One control signal (CMMD) determines the state of the valve.
• If the desired state of an energize-open valve is open (MOPEN=true), thecontrol signal CMMD is set to true.
If the desired state is closed, (MOPEN=false), the CMMD output is set tofalse.
• If the desired state of an energize-closed valve is open (MOPEN=true),the control signal CMMD is set to false.
If the desired state is closed, (MOPEN=false), the CMMD output is set totrue.
• If the CLR_CMMD input is set to true, the CMMD output changes to falsewhen the FTO (for energize-open valves) or FTC (for energize-closedvalves) becomes true. The CMMD output remains false until RESET isset to true.
• The RESET input clears the OVRD input and resets the alarm timer.The alarm timer O_CUR_T or C_CUR_T starts counting down when theRESET input goes false. If the OLS or CLS feedback does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDO and OVRDC inputs.
For both types of valves, the two feedback signals consist of an openfeedback signal (OLS) and a closed feedback signal (CLS).
• The OLS input is expected to be true when the valve is open and falsewhen it is closed.
• The CLS input is expected to be true when the valve is closed and falsewhen it is open.
Overview
8-15SIMATIC PCS 7 OSx 4.1.2 Library Valves
When you use a VSD device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
8-16 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VSD (continued)
The VSD function block is shown in Figure 8-4, and its inputs and outputsare described in Table 8-9 and Table 8-10.
OB351
BO EN
valve_8
VSD
ENO BO1
Single-Drive/D
BO IGN_OVRD
R SAMPLE_T
BO OLS
BO CLS
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTO
BO RTC
BO RESET
R C_ALRM_T
R O_ALRM_T
BO LOCKD
BO MOPEN
BO OVRDO
BO E_STATE
CMMD BO
OPND BO
CLSD BO
TRVL BO
FTO BO
FTC BO
FAILD BO
0
0
0
0
0
0
0
0
0
0.1
1.0
1.0
1
0
0
0
0
0
0
BO CLR_CMMD
O_CUR_T R
BO OVRDC
LOCKD_O BO
C_CUR_T R
Figure 8-4 VSD Block
The VSD Block
8-17SIMATIC PCS 7 OSx 4.1.2 Library Valves
Table 8-9 Input Table for VSD
Element Description Type InitialValue
EN Enable BOOL 1
OLS Open feedback BOOL 0
CLS Closed feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to open valve BOOL 0
RTC Request to close valve BOOL 0
RESET Clear feedback overrides BOOL 0
MOPEN Manual open BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
O_ALRM_T Open alarm time (in seconds) REAL 1.0
C_ALRM_T Close alarm time (in seconds) REAL 1.0
E_STATE Energize state: 1=open, 0=closed BOOL 1
OVRDO Override open feedback BOOL 0
OVRDC Override closed feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
CLR_CMMD Clear CMMD on FTO/FTC BOOL 0
8-18 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VSD (continued)
Table 8-10 Output Table for VSD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Open/close command BOOL 0
OPND Opened BOOL 0
CLSD Closed BOOL 0
TRVL Traveling BOOL 0
FTO Fail to open BOOL 0
FTC Fail to close BOOL 0
FAILD Failed BOOL 0
LOCKD_O Locked output BOOL 0
O_CUR_T Open current time (in seconds) REAL 0.0
C_CUR_T Close current time (in seconds) REAL 0.0
8-19SIMATIC PCS 7 OSx 4.1.2 Library Valves
8.6 VDD (Dual-Drive/Dual-Feedback Valve)
The VDD device (FB348) has two positions (open and closed) and iscontrolled by two discrete signals with two discrete feedback signals.
The two control signals consist of an open signal (OPENC) and a close signal(CLSC), which are both normally false.
• If the desired state is open (MOPEN=true), the OPENC output is set totrue. The OPENC output remains true until either the open feedbacksignal OLS is true or the open alarm time O_ALRM_T expires; thenOPENC is set to false.
• If the desired state is closed, the CLSC output is set to true to close thevalve. The CLSC output remains true until either the close feedbacksignal CLS is true or the close alarm time C_ALRM_T expires; then CLSCis set to false.
• The RESET input clears the OVRD input and resets the alarm timer.The alarm timer O_CUR_T or C_CUR_T starts counting down when theRESET input goes false. If the OLS or CLS feedback does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDO and OVRDC inputs.
The two feedback signals consist of an open feedback signal (OLS) and aclosed feedback signal (CLS).
• The OLS input is expected to be true when the valve is open and falsewhen it is closed.
• The CLS input is expected to be true when the valve is closed and falsewhen it is open.
When you use a VDD device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
8-20 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VDD (continued)
The VDD function block is shown in Figure 8-5, and its inputs and outputsare described in Table 8-11 and Table 8-12.
OB351
BO EN
valve_9
VDD
ENO BO1
Dual-Drive/Dua
BO IGN_OVRD
R SAMPLE_T
BO OLS
BO CLS
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTO
BO RTC
BO RESET
R O_ALRM_T
R C_ALRM_T
BO LOCKD
BO MOPEN
BO OVRDO
CMMD BO
OPENC BO
CLSC BO
OPND BO
CLSD BO
TRVL BO
FTO BO
0
0
0
0
0
0
0
0
0
0
0.1
1.0
1.0
0
0
0
0
FTC BO
BO OVRDC
FAILD BO
OPNTO BO
CLSTO BO
O_CUR_T R
LOCKD_O BO
C_CUR_T R
Figure 8-5 VDD Block
The VDD Block
8-21SIMATIC PCS 7 OSx 4.1.2 Library Valves
Table 8-11 Input Table for VDD
Element Description Type InitialValue
EN Enable BOOL 1
OLS Open feedback BOOL 0
CLS Closed feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to open valve BOOL 0
RTC Request to close valve BOOL 0
RESET Clear feedback overrides BOOL 0
MOPEN Manual open BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
O_ALRM_T Open alarm time (in seconds) REAL 1.0
C_ALRM_T Close alarm time (in seconds) REAL 1.0
OVRDO Override open feedback BOOL 0
OVRDC Override closed feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
8-22 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VDD (continued)
Table 8-12 Output Table for VDD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Open/close command BOOL 0
OPENC Open command BOOL 0
CLSC Close command BOOL 0
OPND Opened BOOL 0
CLSD Closed BOOL 0
TRVL Traveling BOOL 0
FTO Fail to open BOOL 0
FTC Fail to close BOOL 0
FAILD Failed BOOL 0
OPNTO Open timeout BOOL 0
CLSTO Close timeout BOOL 0
LOCKD_O Locked output BOOL 0
O_CUR_T Open current time (in seconds) REAL 0.0
C_CUR_T Close current time (in seconds) REAL 0.0
8-23SIMATIC PCS 7 OSx 4.1.2 Library Valves
8.7 VMD (Motor-Drive/Dual-Feedback Valve)
The VMD device (FB349) has two positions (open and closed) and iscontrolled by two discrete signals with two discrete feedback signals. Thetwo control signals consist of a start signal (OPENC) and a stop signal(CLSC).
• If the desired state of the valve is open (MOPEN=true), the OPENCoutput is set to true until the open feedback (OLS) is true or until thealarm time (O_ALRM_T) expires; then OPENC is set to false.
• If the desired state is closed (MOPEN=false), the CLSC output is set totrue until closed feedback (CLS) is true or until the alarm time(C_ALRM_T) expires; then CLSC is set to false.
• If the valve is stopped in mid-travel (RTS=true), the TRVL outputremains true and the open and close alarm times (O_CUR_T andC_CUR_T) are reset.
• The RESET input clears the OVRD input and resets the alarm timer.The alarm timer O_CUR_T or C_CUR_T starts counting down when theRESET input goes false. If the OLS or CLS feedback does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDO and OVRDC inputs.
The two feedback signals consist of an open feedback signal (OLS) and aclosed feedback signal (CLS).
• The OLS input is expected to be true when the valve is open and falsewhen it is closed.
• The CLS input is expected to be true when the valve is closed and falsewhen it is open.
The VMD valve can be stopped at any point of its travel by setting the RTSinput to true, which clears both control outputs (OPENC and CLSC).
When you use a VMD device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
8-24 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VMD (continued)
The VMD function block is shown in Figure 8-6, and its inputs and outputsare described in Table 8-13 and Table 8-14.
1
0
0
0
0
0
0
0
0
0
0
0
0
0.1
1.0
1.0
0
0
0
valve_10
VMDMotor Drive/Du OB35
1
ENO BO
CMMD BO
OPENC BO
CLSC BO
OPND BO
CLSD BO
TRVL BO
FTO BO
FTC BO
FAILD BO
OPNTO BO
CLSTO BO
O_CUR_T R
LOCKD_O BO
BO EN
BO IGN_OVRD
R SAMPLE_T
BO OLS
BO CLS
BO DSBLD
BO NRDY
BO RTS
BO RTL
BO RTU
BO RTO
BO RTC
BO RESET
R O_ALRM_T
R C_ALRM_T
BO LOCKD
BO MOPEN
BO OVRDO
BO OVRDC
C_CUR_T R
Figure 8-6 VMD Block
The VMD Block
8-25SIMATIC PCS 7 OSx 4.1.2 Library Valves
Table 8-13 Input Table for VMD
Element Description Type InitialValue
EN Enable BOOL 1
OLS Open feedback BOOL 0
CLS Closed feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to open valve BOOL 0
RTC Request to close valve BOOL 0
RTS Request to stop valve BOOL 0
RESET Clear feedback overrides BOOL 0
MOPEN Manual open BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
O_ALRM_T Open alarm time (in seconds) REAL 1.0
C_ALRM_T Close alarm time (in seconds) REAL 1.0
OVRDO Override open feedback BOOL 0
OVRDC Override closed feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
8-26 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VMD (continued)
Table 8-14 Output Table for VMD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Open/close command BOOL 0
OPENC Open command BOOL 0
CLSC Close command BOOL 0
OPND Opened BOOL 0
CLSD Closed BOOL 0
TRVL Traveling BOOL 0
FTO Fail to open BOOL 0
FTC Fail to close BOOL 0
FAILD Failed BOOL 0
OPNTO Open timeout BOOL 0
CLSTO Close timeout BOOL 0
LOCKD_O Locked output BOOL 0
O_CUR_T Open current time (in seconds) REAL 0.0
C_CUR_T Close current time (in seconds) REAL 0.0
8-27SIMATIC PCS 7 OSx 4.1.2 Library Valves
8.8 VUD (User-defined Valve)
For a general discussion of user-defined devices, see Section 7.4.
The VUD device (FB350) has two positions (open and closed) and iscontrolled by two discrete signals with two discrete feedback signals.
The VUD is essentially the shell of a VDD device. The code which definesthe VDD has been reduced to a minimum, and input/output elements havebeen provided to allow you to create your own customized valve andtranslate it for OSx.
The VUD has two alarm timers. When the ORESET (CRESET) inputtransitions from false to true, the alarm timer O_CUR_T (C_CUR_T) starts.When the timer times out, the OPNTO (CLSTO) output becomes true, andremains true until the ORESET (CRESET) input is set to false.
When you use a VUD device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
The VUD function block is shown in Figure 8-7, and its inputs and outputsare described in Table 8-15 and Table 8-16.
Overview
Required Blocks
The VUD Block
8-28 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VUD (continued)
OB351
BO EN
valve_5
VUD
ENO BO1
User Defined
R SAMPLE_T
BO OLS
BO CLS
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
BO RESET
R O_ALRM_T
R C_ALRM_T
BO LOCKD
CMMD BO
OPENC BO
OPND BO
CLSD BO
TRVL BO
FTO BO
0
0
0
0
0
0
0
0
0
0
0
0
0.1
1.0
FTC BO
1.0
FAILD BO
OPNTO BO
CLSTO BO
O_CUR_T R
LOCKD_O BO
BO RHIGH
BO RLOW
0
0
0
BO RTO
0
BO MOPEN
0
0
BO OVRDO
0
BO OVRDC
BO RTOA
BO RTOB
BO CRESET
BO ORESET
CLSC BO
OPNDA BO
OPNDB BO
0
BO IGN_OVRD
C_CUR_T R
Figure 8-7 VUD Block
8-29SIMATIC PCS 7 OSx 4.1.2 Library Valves
Table 8-15 Input Table for VUD
Element Description Type InitialValue
EN Enable BOOL 1
OLS Open feedback BOOL 0
CLS Closed feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to open valve BOOL 0
RTOA Request to open valve, option A, H BOOL 0
RTOB Request to open valve, option B, L BOOL 0
RHIGH Request to open valve high BOOL 0
RLOW Request to open valve low BOOL 0
RTC Request to close valve BOOL 0
RESET Clear feedback overrides BOOL 0
MOPEN Manual open BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
O_ALRM_T Open alarm time (in seconds) REAL 1.0
C_ALRM_T Close alarm time (in seconds) REAL 1.0
OVRDO Override open feedback BOOL 0
OVRDC Override closed feedback BOOL 0
IGN_OVRD Ignore feedback overrides BOOL 0
ORESET Open alarm timer reset BOOL 0
CRESET Close alarm timer reset BOOL 0
8-30 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
VUD (continued)
Table 8-16 Output Table for VUD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Open/close command BOOL 0
OPENC Open command BOOL 0
CLSC Close command BOOL 0
OPND Opened BOOL 0
OPNDA Opened option A BOOL 0
OPNDB Opened option B BOOL 0
CLSD Closed BOOL 0
TRVL Traveling BOOL 0
FTO Fail to open BOOL 0
FTC Fail to close BOOL 0
FAILD Failed BOOL 0
OPNTO Open timeout BOOL 0
CLSTO Close timeout BOOL 0
LOCKD_O Locked output BOOL 0
O_CUR_T Open current time (in seconds) REAL 0.0
C_CUR_T Close current time (in seconds) REAL 0.0
8-31SIMATIC PCS 7 OSx 4.1.2 Library Valves
8.9 BV1 (Three-Position Valve/Type 1)
The BV1 device (FB351) is a three-position valve (high, low, and closed) andis controlled by two discrete signals with two discrete feedback signals.
The two discrete control signals consist of a low signal (SLOW) and a highsignal (SHIGH). The two signals cannot both be true at the same time.
• If the desired state of the valve is open at high position (MOPEN=trueand MHIGH=true), the SHIGH output is set to true (energized) to openthe valve at high position.
• If the desired state of the valve is open at low position (MOPEN=trueand MHIGH=false), the SLOW output is set to true (energized) to openthe valve at low position.
• If the desired state is closed (MOPEN=false), the currently energizedsignal (SHIGH or SLOW) is set to false.
• The valve, when receiving an open signal, starts opening and keepsopening until the currently energized signal becomes false.
• You can change the position of a three-position valve without closing it.
• The RESET input clears the OVRD input and resets the alarm timer.The alarm timer (O_CUR_T or C_CUR_T) starts counting down when theRESET input goes false. If the OLS or CLS feedback does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDH and OVRDL inputs.
The two feedback signals consist of an open-low feedback signal (LIO) and anopen-high feedback signal (HIO).
• The LIO input is expected to be true when the valve is open at the lowposition and false when it is not.
• The HIO input is expected to be true when the valve is open at the highposition and false when it is not.
• If you set SAME_FBK to true, only the LIO feedback is active. Anyfeedback connections must then be made to the LIO input.
Overview
8-32 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
BV1 (continued)
In manual mode, the outputs SLOW/SHIGH are set to the appropriate statebased on the status of the MHIGH and the MOPEN inputs, which youmanipulate from an operator station or from the program.
In auto mode, the RLOW, RHIGH, and RTC inputs set the state of theseelements, as follows:
RLOW sets MOPEN=1 and MHIGH=0
RHIGH sets MOPEN=1 and MHIGH=1
RTC sets MOPEN=0 and leaves MHIGH in its last state
In this mode, the MHIGH and MOPEN elements are set to reflect the lastrequested state. This is done to provide for a bumpless transfer if the devicechanges modes.
When you use a BV1 device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
8-33SIMATIC PCS 7 OSx 4.1.2 Library Valves
The BV1 function block is shown in Figure 8-8, and its inputs and outputsare described in Table 8-17 and Table 8-18.
OB351
BO EN
valve_14
BV1
ENO BO1
Three Position 1
BO SAME_FBK
R SAMPLE_T
BO HIO
BO LIO
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
BO RESET
R O_ALRM_T
R C_ALRM_T
BO LOCKD
BO MOPEN
BO MHIGH
SHIGH BO
SLOW BO
OPND BO
CLSD BO
TRVL BO
FTO BO
0
0
0
0
0
0
0
0
0
0
0.1
1.0
1.0
0
0
FTC BO
BO OVRDH
0
FAILD BO
OPNTO BO
CLSTO BO
O_CUR_T R
LOCKD_O BO
BO RHIGH
BO RLOW
0
0
BO OVRDL
0
OPNDH BO
OPNDL BO
FTOH BO
FTOL BO
BO IGN_OVRD
0
C_CUR_T R
Figure 8-8 BV1 Block
The BV1 Block
8-34 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
BV1 (continued)
Table 8-17 Input Table for BV1
Element Description Type InitialValue
EN Enable BOOL 1
HIO Open high feedback BOOL 0
LIO Open low feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RHIGH Request to open high BOOL 0
RLOW Request to open low BOOL 0
RTC Request to close valve BOOL 0
RESET Clear feedback overrides BOOL 0
MOPEN Manual open BOOL 0
MHIGH Manual high BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
O_ALRM_T Open alarm time (in seconds) REAL 1.0
C_ALRM_T Close alarm time (in seconds) REAL 1.0
OVRDH Override high feedback BOOL 0
OVRDL Override low feedback BOOL 0
IGN_OVRD Ignore feedback overrides BOOL 0
SAME_FBK Same feedback (LIO=HIO) BOOL 0
8-35SIMATIC PCS 7 OSx 4.1.2 Library Valves
Table 8-18 Output Table for BV1
Element Description Type InitialValue
ENO Output valid BOOL 0
SHIGH Open high BOOL 0
SLOW Open low BOOL 0
OPND Opened BOOL 0
OPNDH Opened high, option H BOOL 0
OPNDL Opened low, option L BOOL 0
CLSD Closed BOOL 0
TRVL Traveling BOOL 0
FTO Fail to open BOOL 0
FTOH Fail to open high BOOL 0
FTOL Fail to open low BOOL 0
FTC Fail to close BOOL 0
FAILD Failed BOOL 0
OPNTO Open timeout BOOL 0
CLSTO Close timeout BOOL 0
LOCKD_O Locked output BOOL 0
O_CUR_T Open current time (in seconds) REAL 0.0
C_CUR_T Close current time (in seconds) REAL 0.0
8-36 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
8.10 BV2 (Three-Position Valve/Type 2)
The BV2 device (FB352) is a three-position valve (high, low, and closed) andis controlled by two discrete control signals with two discrete feedbacksignals.
The two control signals consist of an open/close signal (DRV) and a positionsignal (POS) that determines whether the valve opens at high or lowposition.
• If the desired state of the valve is open high (MOPEN=true andMHIGH=true), the DRV and POS outputs are both set to true.
• If the desired state is open low (MOPEN=true and MHIGH=false), theDRV output is set to true and the POS output is set to false.
• If the desired state is closed (MOPEN=false), the DRV output is set tofalse to close the valve.
• The valve, when receiving an open signal, starts opening and keepsopening until DRV becomes false.
• You can change the position of a three-position valve without closing it.
• The RESET input clears the OVRD input and resets the alarm timer.The alarm timer (O_CUR_T or C_CUR_T) starts counting down when theRESET input goes false. If the OLS or CLS feedback does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDH and OVRDL inputs.
The two feedback signals consist of an open low feedback signal (LIO) and anopen high feedback signal (HIO).
• The LIO input is expected to be true when the valve is open at lowposition and false when it is not.
• The HIO input is expected to be true when the valve is open at highposition and false when it is not.
• If you set SAME_FBK to true, only the LIO feedback is active. Anyfeedback connections must then be made to the LIO input.
Overview
8-37SIMATIC PCS 7 OSx 4.1.2 Library Valves
In manual mode, the outputs DRV/POS are set to the appropriate state basedon the status of the MHIGH and the MOPEN inputs, which you manipulatefrom an operator station or from the program.
In auto mode, the RLOW, RHIGH, and RTC inputs set the state of theseoutputs, as follows:
RLOW sets MOPEN=1 and MHIGH=0
RHIGH sets MOPEN=1 and MHIGH=1
RTC sets MOPEN=0 and leaves MHIGH in its last state
In this mode, the MHIGH and MOPEN elements are set to reflect the lastrequested state. This is done to provide for a bumpless transfer if the devicechanges modes.
When you use a BV2 device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
8-38 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
BV2 (continued)
The BV2 function block is shown in Figure 8-9, and its inputs and outputsare described in Table 8-19 and Table 8-20.
OB11
BO EN
valve_15
BV2
ENO BO1
Three Position 2
BO SAME_FBK
R SAMPLE_T
BO HIO
BO LIO
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
BO RESET
R C_ALRM_T
R O_ALRM_T
BO LOCKD
BO MOPEN
BO MHIGH
DRV BO
POS BO
OPND BO
CLSD BO
TRVL BO
FTO BO
0
0
0
0
0
0
0
0
0
0
0.1
1.0
1.0
0
0
FTC BO
BO OVRDH
0
FAILD BO
OPNTO BO
CLSTO BO
O_CUR_T R
LOCKD_O BO
BO RHIGH
BO RLOW
0
0
BO OVRDL
0
OPNDH BO
OPNDL BO
FTOH BO
FTOL BO
0
BO IGN_OVRD
C_CUR_T R
Figure 8-9 BV2 Block
The BV2 Block
8-39SIMATIC PCS 7 OSx 4.1.2 Library Valves
Table 8-19 Input Table for BV2
Element Description Type InitialValue
EN Enable BOOL 1
HIO Open high feedback BOOL 0
LIO Open low feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RHIGH Request to open high BOOL 0
RLOW Request to open low BOOL 0
RTC Request to close valve BOOL 0
RESET Clear feedback overrides BOOL 0
MOPEN Manual open BOOL 0
MHIGH Manual high BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
O_ALRM_T Open alarm time (in seconds) REAL 1.0
C_ALRM_T Close alarm time (in seconds) REAL 1.0
OVRDH Override high feedback BOOL 0
OVRDL Override low feedback BOOL 0
IGN_OVRD Ignore feedback overrides BOOL 0
SAME_FBK Same feedback (LIO=HIO) BOOL 0
8-40 SIMATIC PCS 7 OSx 4.1.2 LibraryValves
BV2 (continued)
Table 8-20 Output Table for BV2
Element Description Type InitialValue
ENO Output valid BOOL 0
DRV Open/close command BOOL 0
POS Open position (high/low) BOOL 0
OPND Opened BOOL 0
OPNDH Opened high BOOL 0
OPNDL Opened low BOOL 0
CLSD Closed BOOL 0
TRVL Traveling BOOL 0
FTO Fail to open BOOL 0
FTOH Fail to open high BOOL 0
FTOL Fail to open low BOOL 0
FTC Fail to close BOOL 0
FAILD Failed BOOL 0
OPNTO Open timeout BOOL 0
CLSTO Close timeout BOOL 0
LOCKD_O Locked output BOOL 0
O_CUR_T Open current time (in seconds) REAL 0.0
C_CUR_T Close current time (in seconds) REAL 0.0
9-1SIMATIC PCS 7 OSx 4.1.2 Library Valve Control
Chapter 9
Valve Control
9.1 MPC (Motor Position Control) 9-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2 PTC (Proportional Time Control) 9-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3 SPL_RNG (Split Range) 9-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.4 VLV_SEQ (Valve Sequencer) 9-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9-2 SIMATIC PCS 7 OSx 4.1.2 LibraryValve Control
9.1 MPC (Motor Position Control)
The MPC (motor position control) function block (FB418) is used to drive amotor-driven valve to an intermediate position between 0 and 100%. Themotor-driven valve is a device (VMD) that you place on the CFC with theMPC block.
The input IN to the block is a feedback signal that indicates the position ofthe valve as a scaled value between 0.0 and 1.0. The setpoint SP should be areal value between 0.0 and 1.0. The algorithm compares the input to thesetpoint.
• If the difference between the input and the setpoint is outside therange specified by the dead zone DZONE, the signals that open and closethe valve are manipulated.
• If the difference between the input and the setpoint is within the deadzone, no control action is taken.
The DZONE value is entered as a normalized percentage (0.0 to 1.0).
The motor position control block expects the valve to be in a locked state.(See Chapter 8 for information about locking a motor-driven valve.) If theblock is enabled and the valve is not locked, the block does not execute untilthe valve is locked. The block does not check any other outputs that areassociated with the valve. On the first execution after the block is enabled,the value of the input is copied to the setpoint, effecting a “bumpless”transfer.
When you use an MPC block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
9-3SIMATIC PCS 7 OSx 4.1.2 Library Valve Control
Figure 9-1 shows how the MPC function block works to control a VMD valveblock in a CFC.
1
0
0
0
0
0
0
0
10
0.1
1.0
1.0
0
0
0
Valve1
VMDMotor Drive/Du OB35
5/ --
ENO BO
CMMD BO
OPENC BO
CLSC BO
OPND BO
CLSD BO
TRVL BO
FTO BOFTC BO
FAILD BO
OPNTO BO
CLSTO BO
O_CUR_T R
LOCKD_O BO
BO EN
BO IGN_OVRD
R SAMPLE_T
BO OLS
BO CLS
BO DSBLD
BO NRDY
BO RTS
BO RTL
BO RTU
BO RTO
BO RTC
BO RESET
R O_ALRM_T
R C_ALRM_T
BO LOCKD
BO MOPEN
BO OVRDO
BO OVRDC
C_CUR_T R
MasterMPC
Motor Position OB354/ --
ENO BO
DCLOSE BO
DSTOP BO
BO EN
BO REN
BO RDIS
DOPEN BO
BO ENABL
BO NRDY
R IN
R SP
R DZONE
BO DLOCKD
0
1
00
1
0.0
0.50.001
Figure 9-1 Using the MPC Block
9-4 SIMATIC PCS 7 OSx 4.1.2 LibraryValve Control
MPC (continued)
The MPC function block is shown in Figure 9-2, and its inputs and outputsare described in Table 9-1 and Table 9-2.
OB351
BO EN
mpc_3
MPC
ENO BO1
Motor Position
BO NRDY
BO REN DOPEN BO
DCLOSE BO
0
0
0
0
0.0
0.0
0.001
BO RDIS
BO ENABL
R IN
R SP
R DZONE
BO DLOCKD0
DSTOP BO
Figure 9-2 MPC Block
The MPC Block
9-5SIMATIC PCS 7 OSx 4.1.2 Library Valve Control
Table 9-1 Input Table for MPC
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
IN Process input value REAL 0.0
SP Setpoint REAL 0.0
DZONE Dead zone REAL 0.001
DLOCKD Device locked BOOL 0
Table 9-2 Output Table for MPC
Element Description Type InitialValue
ENO Output valid BOOL 0
DOPEN Device open command BOOL 0
DCLOSE Device close command BOOL 0
DSTOP Device stop command BOOL 0
9-6 SIMATIC PCS 7 OSx 4.1.2 LibraryValve Control
9.2 PTC (Proportional Time Control)
The PTC (proportional time control) function block (FB385) is used to makean on/off device act like a continuous device. This block allows you to set anoutput to true for a specified fraction of its duty cycle and to false for therest of the time.
Proportional time control is commonly applied to extruders. For example,you might control the temperature of a zone in an extruder by switching theheater associated with that zone on and off.
By pulsing an output according to the load on the system, the oscillation ofthe controlled variable can be reduced, and the amount of energy added tothe system is more in line with what is needed. For example, a fully loadedsystem has full heating all of the time; a system with no load has heatingnone of the time.
The IN input to the block specifies the fraction of the time that the controloutput D_OUT should be true (open or running for devices). The duty cyclespecifies how often the algorithm should re-evaluate the on/off time of theoutput. For example, if the duty cycle DUTY_TIM is 10 seconds and IN=0.5,the output is true for five seconds and false for five seconds. At the end ofeach ten-second period, the input is re-evaluated to determine the on/offtime for the output.
The PTC function block is shown in Figure 9-3, and its inputs and outputsare described in Table 9-3 and Table 9-4.
OB351
BO EN
ptc_2
PTC
ENO BO1
Proportional T
R SAMPLE_T
BO NRDY
BO REN ENABLD BO
D_OUT BO
0
0
0
0
0.1
10.0
0.0
BO RDIS
BO ENABL
R DUTY_TIME
R IN
Figure 9-3 PTC Block
Overview
The PTC Block
9-7SIMATIC PCS 7 OSx 4.1.2 Library Valve Control
Table 9-3 Input Table for PTC
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
DUTY_TIME Time for duty cycle (in seconds) REAL 10.0
IN Fraction of time that output is true REAL 0.0
Table 9-4 Output Table for PTC
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
D_OUT Boolean output BOOL 0
9-8 SIMATIC PCS 7 OSx 4.1.2 LibraryValve Control
9.3 SPL_RNG (Split Range)
The SPL_RNG (split range) function block (FB386) allows you to split aninput signal into two output signals. The input must be a real numberbetween 0 and 1.
As the input signal changes from 0.0 to 1.0, the two outputs change. Whenyou define the block, you enter the input range that specifies the input atwhich each output first reaches the 0.0% state.
• When the input IN is 0.0, the first output OUT1 (A) is 100% (1.0); thesecond output OUT2 (B) is 0.0% (0.0). If the reverse scaling optionREV_SCAL is true, both outputs (A and B) are 0.0% (0.0). SeeFigure 9-4.
• When the input IN is 1.0, the first output OUT1 (A) is 0.0% (0.0); thesecond output OUT2 (B) is 100.0% (1.0). If the reverse scaling optionREV_SCAL is true, both outputs (A and B) are 100% (1.0). SeeFigure 9-4.
Breakpoints BRKP1 and BRKP2 can overlap so that at some time bothoutputs are non-zero over some range of input values. Also, the breakpointranges can be set so that there is a band of input ranges over which bothoutputs are 0.0.
When the split range block is not active, the outputs are not updated by thesplit range block. To manipulate the outputs, write a value to the input thatsets the outputs to the desired values, and then activate the block.
Input
Output
0.0
1.0
Normal Scaling
1.0
Output
Input
Output
0.0
1.0
Reverse Scaling
1.0
OutputOutput OutputA B A B
0.01.0 0.01.0Input
1.0
Input
1.0
Figure 9-4 Split Range Reverse and Normal Scaling
Overview
9-9SIMATIC PCS 7 OSx 4.1.2 Library Valve Control
The SPL_RNG function block is shown in Figure 9-5, and its inputs andoutputs are described in Table 9-5 and Table 9-6.
OB351
BO EN
split_3
SPL_RNG
ENO BO1
Split Range
BO NRDY
BO REN
BO RDIS
ENABLD BO
0.495
0.505
0
0
0
0
0.0
BO ENABL
0
OUT1 R
OUT2 R
BO REV_SCAL
R IN
R BRKP1
R BRKP2
Figure 9-5 SPL_RNG Block
The SPL_RNGBlock
9-10 SIMATIC PCS 7 OSx 4.1.2 LibraryValve Control
SPL_RNG (continued)
Table 9-5 Input Table for SPL_RNG
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
IN Input value REAL 0.0
BRKP1 First breakpoint REAL 0.495
BRKP2 Second breakpoint REAL 0.505
REV_SCAL Reverse scaling: 0=normal, 1=reverse BOOL 0
Table 9-6 Output Table for SPL_RNG
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
OUT1 First output REAL 0.0
OUT2 Second output REAL 0.0
9-11SIMATIC PCS 7 OSx 4.1.2 Library Valve Control
9.4 VLV_SEQ (Valve Sequencer)
The VLV_SEQ (valve sequencer) function block (FB419) manipulates twocontinuous control valves with a single output OUT. A control I/O pointCTRL_PT determines which valve responds to the output signal.
The output of the VLV_SEQ block controls two valves: one must be anenergize-open valve (E_STATE=1), and the other must be an energize-closevalve (E_STATE=0).
One valve is associated with the false value (0) of the control I/O pointCTRL_PT and the other with the true value (1). When the output signal OUTreaches the increasing switch point INC_SWP, the “false” valve is fully open.When the output signal OUT reaches the decreasing switch point DEC_SWP,the “true” valve is at a fully closed position.
You can select either direct or reverse valve action by setting the inputVLV_ACT to true (1) for direct or false (0) for reverse.
• Direct action increases the output as the input increases.
• Reverse action decreases the output as the input increases.
You can select a characterization type of none, equal %, or interpolationwith the input CHARAC (0=none, 1=equal %, 2=interpolation).
• If you select a characterization type of none, there is a linearrelationship between the input and the output and they are alwaysequal.
• If you select a characterization type of equal %, the relationshipbetween the input and output is determined by the following equation.Rangeability (the RNG_BLTY input) is a number between 0.0 and 100.0that you can set in the Block Object Properties I/O folder.
where Z = 1rangeability
output = inputZ + ((1− Z) × input)
• If you select a characterization type of interpolation, the output isdetermined by input IN_AR# and output OUT_AR# arrays that eachcontain 11 elements. The values for these arrays can be set in the BlockObject Properties I/O folder. (See the explanation of Correlated LookupTable in Section 6.4 for more information about these arrays.)
Overview
9-12 SIMATIC PCS 7 OSx 4.1.2 LibraryValve Control
VLV_SEQ (continued)
When you use a VLV_SEQ block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
The VLV_SEQ function block is shown in Figure 9-6, and its inputs andoutputs are described in Table 9-7 and Table 9-8.
OB351
BO EN
seq_2
VLV_SEQ
ENO BO1
Valve sequence
BO NRDY
BO REN
BO RDIS
ENABLD BO
55.0
45.0
0
0
0
1
0.0
BO ENABL
0
OUT R
CTRL_PT BO
BO VLV_ACT
R IN
R INC_SWP
R DEC_SWP
0 I CHARAC
Figure 9-6 VLV_SEQ Block
Required Blocks
The VLV_SEQBlock
9-13SIMATIC PCS 7 OSx 4.1.2 Library Valve Control
Table 9-7 Input Table for VLV_SEQ
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
IN Input value REAL 0.0
INC_SWP Increasing switchpoint (value between 0.0 and 100.0) REAL 55.0
DEC_SWP Decreasing switchpoint (value between 0.0 and 100.0) REAL 45.0
VLV_ACT Valve action (1=direct, 0=reverse) BOOL 1
CHARAC Characterization type (0=none, 1=equal %, 2=interpolation) INT 0
RNG_BLTY * Rangeablity (%) REAL 0.0
IN_AR#(1--11) * Input array value (for up to 11 elements) REAL 0.0
OUT_AR#(1--11) * Output array value (for up to 11 elements) REAL 0.0
* These inputs are invisible but function as described on page 9-11. To make the inputs visible see theprocedure on page1-14.
Table 9-8 Output Table for VLV_SEQ
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
OUT Output value REAL 0.0
CTRL_PT Control point BOOL 0
9-14 SIMATIC PCS 7 OSx 4.1.2 LibraryValve Control
10-1SIMATIC PCS 7 OSx 4.1.2 Library Motors
Chapter 10
Motors
10.1 Motor Inputs and Outputs 10-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2 MSN (Single-Drive/Null-Feedback Motor) 10-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.3 MSS (Single-Drive/Single-Feedback Motor) 10-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.4 MDN (Dual-Drive/Null-Feedback Motor) 10-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.5 MDS (Dual-Drive/Single-Feedback Motor) 10-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.6 MUD (User-defined Motor) 10-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.7 RM1 (Reversible Motor/Type 1) 10-22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.8 RM2 (Reversible Motor/Type 2) 10-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.9 TS1 (Two-Speed Motor/Type 1) 10-32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.10 TS2 (Two-Speed Motor/Type 2) 10-37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10-2 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
10.1 Motor Inputs and Outputs
Table 10-1 and Table 10-2 list the input and output elements for motordevices and show the types of motors that use each element.
Table 10-1 Motor Inputs
Element Description Motor Types
EN Enable MSN MSS MDN MDS RM1/2 TS1/2 MUD
RUNIO Run feedback MSS MDS MUD
FIO Forward feedback RM1/2
RIO Reverse feedback RM1/2
HIO High feedback TS1/2
LIO Low feedback TS1/2
RTL Request to lock (place in automode) MSN MSS MDN MDS RM1/2 TS1/2 MUD
RTU Request to unlock (place inmanual mode) MSN MSS MDN MDS RM1/2 TS1/2 MUD
RTR Request to start motor MSN MSS MDN MDS MUD
RFWRD Request to start forward RM1/2
RREV Request to start reverse RM1/2
RHIGH Request to start high TS1/2
RLOW Request to start low TS1/2
RTS Request to stop motor MSN MSS MDN MDS MUD
RSTOP Request to stop motor RM1/2 TS1/2
RESET Clear feedback overrides MSS MDS RM1/2 TS1/2 MUD
MSTRT Manual start MSN MSS MDN MDS RM1/2 TS1/2 MUD
MREV Manual reverse RM1/2
MHIGH Manual high TS1/2
DSBLD Forced to manual mode MSN MSS MDN MDS RM1/2 TS1/2 MUD
LOCKD Locked (auto mode) MSN MSS MDN MDS RM1/2 TS1/2 MUD
NRDY Not ready MSN MSS MDN MDS RM1/2 TS1/2 MUD
SAMPLE_T Sample time (in seconds) MSN MSS MDN MDS RM1/2 TS1/2 MUD
R_ALRM_T Run alarm time (in seconds) MSN MSS MDN MDS RM1/2 TS1/2 MUD
S_ALRM_T Stop alarm time (in seconds) MSN MSS MDN MDS RM1/2 TS1/2 MUD
Table continues on next page.
10-3SIMATIC PCS 7 OSx 4.1.2 Library Motors
Table 10-1 Motor Inputs (continued)
Element Description Motor Types
OVRD Override feedback MSS MDS MUD
OVRDF Override forward feedback RM1/2
OVRDR Override reverse feedback RM1/2
OVRDH Override high feedback TS1/2
OVRDL Override low feedback TS1/2
IGN_OVRD Ignore feedback override MSS MDS RM1/2 TS1/2
CLR_CMMD Clear CMMD on FTR/FTS MSS
SAME_FBK Same feedback (LIO=HIO) TS1/2
RRESET Run reset MUD
SRESET Stop reset MUD
10-4 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
Motor Inputs and Outputs (continued)
Table 10-2 Motor Outputs
Element Description Motor Types
ENO Output valid MSN MSS MDN MDS RM1/2 TS1/2 MUD
CMMD Start/stop command MSN MSS MDN MDS MUD
STRTC Start command MDN MDS MUD
STOPC Stop command MDN MDS MUD
SFWRD Start forward command RM1
SREV Start reverse command RM1
SHIGH Start high command TS1
SLOW Start low command TS1
DRV Start command RM2 TS2
DIR Direction command RM2
SPEED Speed command TS2
RUNNG Running MSN MSS MDN MDS RM1/2 TS1/2 MUD
RUNF Running forward RM1/2
RUNR Running reverse RM1/2
RUNH Running high TS1/2
RUNL Running low TS1/2
STPPD Stopped MSN MSS MDN MDS RM1/2 TS1/2 MUD
TRVL Traveling MSN MSS MDN MDS RM1/2 TS1/2 MUD
FTR Fail to run MSS MDS RM1/2 TS1/2 MUD
FTRF Fail to run forward RM1/2
FTRR Fail to run reverse RM1/2
FTRH Fail to run high TS1/2
FTRL Fail to run low TS1/2
FTS Fail to stop MSS MDS RM1/2 TS1/2 MUD
FAILD Failed RM1/2 TS1/2
STRTO Start timeout MDS RM1/2 TS1/2 MUD
STPTO Stop timeout MDS RM1/2 TS1/2 MUD
LOCKD_O Locked output MSN MSS MDN MDS RM1/2 TS1/2 MUD
R_CUR_T Run current time (in seconds) MSN MSS MDN MDS RM1/2 TS1/2 MUD
S_CUR_T Stop current time (in seconds) MSN MSS MDN MDS RM1/2 TS1/2 MUD
10-5SIMATIC PCS 7 OSx 4.1.2 Library Motors
10.2 MSN (Single-Drive/Null-Feedback Motor)
The MSN device (FB362) is a two-state motor (running and stopped) and iscontrolled by a single discrete signal with no feedback.
• If the desired state of the motor is running (MSTRT=true), the controlsignal CMMD is set to true.
• If the desired state is stopped (MSTRT=false), the CMMD output is set tofalse.
When you use an MSN device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
10-6 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
MSN (continued)
The MSN function block is shown in Figure 10-1, and its inputs and outputsare described in Table 10-3 and Table 10-4.
OB351
BO EN
motor_23
MSN
ENO BO1
Single-Drive/N
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTR
R R_ALRM_T
R S_ALRM_T
BO LOCKD
BO MSTRT
CMMD BO
RUNNG BO
STPPD BO
TRVL BO
0
0
0
0
0
0
1.0
1.0
0
0
R_CUR_T R
LOCKD_O BO
BO RTS
0.1
S_CUR_T R
Figure 10-1 MSN Block
The MSN Block
10-7SIMATIC PCS 7 OSx 4.1.2 Library Motors
Table 10-3 Input Table for MSN
Element Description Type InitialValue
EN Enable BOOL 1
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTR Request to start motor BOOL 0
RTS Request to stop motor BOOL 0
MSTRT Manual start BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
R_ALRM_T Run alarm time (in seconds) REAL 1.0
S_ALRM_T Stop alarm time (in seconds) REAL 1.0
Table 10-4 Output Table for MSN
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Start/stop command BOOL 0
RUNNG Running BOOL 0
STPPD Stopped BOOL 0
TRVL Traveling BOOL 0
LOCKD_O Locked output BOOL 0
R_CUR_T Run current time (in seconds) REAL 0.0
S_CUR_T Stop current time (in seconds) REAL 0.0
10-8 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
10.3 MSS (Single-Drive/Single-Feedback Motor)
The MSS device (FB363) is a two-state motor (running and stopped) and iscontrolled by a single discrete signal with a single discrete feedback signal.
• If the desired state of the motor is running (MSTRT=true), the controlsignal CMMD is set to true.
• If the desired state of the motor is stopped (MSTRT=false), the controlsignal CMMD is set to false.
• The feedback signal RUNIO is expected to be true when the motor isrunning and false when the motor is stopped.
• If the CLR_CMMD input is set to true, the CMMD output changes to falsewhen the FTR output becomes true. The CMMD output remains falseuntil RESET is set to true.
• The RESET input clears the OVRD input and resets the alarm timers.The alarm timer (R_ALRM_T or S_ALRM_T) starts counting down whenthe RESET input goes false. If the RUNIO feedback does not reflect thecorrect state (1 for run, 0 for stop), the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRD input.
When you use an MSS device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
10-9SIMATIC PCS 7 OSx 4.1.2 Library Motors
The MSS function block is shown in Figure 10-2, and its inputs and outputsare described in Table 10-5 and Table 10-6.
OB351
BO EN
motor_24
MSS
ENO BO1
Single-Drive/S
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTS
BO RESET
BO LOCKD
CMMD BO
RUNNG BO
STPPD BO
TRVL BO
FTR BO
0
0
0
0
0
0
0
0
1.0
1.0
FTS BO
R_CUR_T R
LOCKD_O BO
0
0.1
BO RTR
0
BO MSTRT
BO OVRD
BO RUNIO
R R_ALRM_T
R S_ALRM_T
0
0 BO IGN_OVRD
BO CLR_CMMD0
S_CUR_T R
Figure 10-2 MSS Block
The MSS Block
10-10 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
MSS (continued)
Table 10-5 Input Table for MSS
Element Description Type InitialValue
EN Enable BOOL 1
RUNIO Run feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTR Request to start motor BOOL 0
RTS Request to stop motor BOOL 0
RESET Clear feedback override BOOL 0
MSTRT Manual start BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
R_ALRM_T Run alarm time (in seconds) REAL 1.0
S_ALRM_T Stop alarm time (in seconds) REAL 1.0
OVRD Override feedback BOOL 0
IGN_OVRD Ignore override feedback BOOL 0
CLR_CMMD Clear CMMD on FTR/FTS BOOL 0
Table 10-6 Output Table for MSS
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Start/stop command BOOL 0
RUNNG Running BOOL 0
STPPD Stopped BOOL 0
TRVL Traveling BOOL 0
FTR Fail to run BOOL 0
FTS Fail to stop BOOL 0
LOCKD_O Locked output BOOL 0
R_CUR_T Run current time (in seconds) REAL 0.0
S_CUR_T Stop current time (in seconds) REAL 0.0
10-11SIMATIC PCS 7 OSx 4.1.2 Library Motors
10.4 MDN (Dual-Drive/Null-Feedback Motor)
The MDN device (FB364) is a two-state motor (running and stopped) and iscontrolled by two discrete signals with no feedback.
The two discrete control signals consist of a start signal STRTC and a stopsignal STOPC.
• If the desired state of the motor is running (MSTRT=true), the STRTCoutput is set to true to start the motor. The STRTC output remains trueuntil the start alarm time R_ALRM_T expires; then STRTC is set to false.
• If the desired state of the motor is stopped (MSTRT=false), the STOPCoutput is set to true to stop the motor. The STOPC ouput remains trueuntil the stop alarm time S_ALRM_T expires; then STOPC is set to false.
When you use an MDN device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
10-12 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
MDN (continued)
The MDN function block is shown in Figure 10-3, and its inputs and outputsare described in Table 10-7 and Table 10-8.
OB351
BO EN
motor_25
MDN
ENO BO1
Dual-Drive/Nul
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTS
R R_ALRM_T
R S_ALRM_T
BO LOCKD
CMMD BO
STRTC BO
RUNNG BO
STPPD BO
TRVL BO
0
0
0
0
0
0
0
0.1
1.0
1.0
R_CUR_T R
LOCKD_O BO
BO RTR
0
BO MSTRT
STOPC BO
S_CUR_T R
Figure 10-3 MDN Block
The MDN Block
10-13SIMATIC PCS 7 OSx 4.1.2 Library Motors
Table 10-7 Input Table for MDN
Element Description Type InitialValue
EN Enable BOOL 1
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTR Request to start motor BOOL 0
RTS Request to stop motor BOOL 0
MSTRT Manual start BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
R_ALRM_T Run alarm timer (in seconds) REAL 1.0
S_ALRM_T Stop alarm timer (in seconds) REAL 1.0
Table 10-8 Output Table for MDN
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Start/stop command BOOL 0
STRTC Start command BOOL 0
STOPC Stop command BOOL 0
RUNNG Running BOOL 0
STPPD Stopped BOOL 0
TRVL Traveling BOOL 0
LOCKD_O Locked output BOOL 0
R_CUR_T Run current time (in seconds) REAL 0.0
S_CUR_T Stop current time (in seconds) REAL 0.0
10-14 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
10.5 MDS (Dual-Drive/Single-Feedback Motor)
The MDS device (FB365) is a two-state motor (running and stopped) and iscontrolled by two discrete signals with a single discrete feedback signal.
The two discrete control signals consist of a start signal STRTC and a stopsignal STOPC.
• If the desired state of the motor is running (MSTRT=true), the STRTCoutput is set to true to start the motor. The STRTC output remains trueuntil either RUNNG equals true or the start alarm time R_ALRM_Texpires; then STRTC is set to false.
• If the desired state of the motor is stopped (MSTRT=false), the STOPCoutput is set to true to stop the motor. The STOPC output remains trueuntil either STPPD equals true or the stop alarm time S_ALRM_Texpires; then STOPC is set to false.
• It is not necessary to keep either of the control signals on once themotor is in the desired state.
• The RESET input clears the OVRD input and resets the alarm timers.The alarm timer (R_ALRM_T or S_ALRM_T) starts counting down whenthe RESET input goes false. If the RUNIO feedback does not reflect thecorrect state (1 for run, 0 for stop), the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRD input.
The feedback signal RUNIO is expected to be true when the motor is runningand false when the motor is stopped.
When you use an MDS device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
10-15SIMATIC PCS 7 OSx 4.1.2 Library Motors
The MDS function block is shown in Figure 10-4, and its inputs and outputsare described in Table 10-9 and Table 10-10.
OB351
BO EN
motor_26
MDS
ENO BO1
Dual-Drive/Sin
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTS
BO RESET
R R_ALRM_T
R S_ALRM_T
BO LOCKD
CMMD BO
STRTC BO
RUNNG BO
STPPD BO
TRVL BO
FTR BO
0
0
0
1.0
0
0
0
0
0
0.1
1.0
FTS BO
STRTO BO
STPTO BO
R_CUR_T R
LOCKD_O BO
0
0
BO RTR
0
BO MSTRT
BO OVRD
STOPC BO
BO RUNIO
BO IGN_OVRD
0
S_CUR_T R
Figure 10-4 MDS Block
The MDS Block
10-16 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
MDS (continued)
Table 10-9 Input Table for MDS
Element Description Type InitialValue
EN Enable BOOL 1
RUNIO Run feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTR Request to start motor BOOL 0
RTS Request to stop motor BOOL 0
RESET Clear feedback override BOOL 0
MSTRT Manual start BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
R_ALRM_T Run alarm timer (in seconds) REAL 1.0
S_ALRM_T Stop alarm timer (in seconds) REAL 1.0
OVRD Override feedback BOOL 0
IGN_OVRD Ignore override feedback BOOL 0
10-17SIMATIC PCS 7 OSx 4.1.2 Library Motors
Table 10-10 Output Table for MDS
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Start/stop command BOOL 0
STRTC Start command BOOL 0
STOPC Stop command BOOL 0
RUNNG Running BOOL 0
STPPD Stopped BOOL 0
TRVL Traveling BOOL 0
FTR Fail to run BOOL 0
FTS Fail to stop BOOL 0
STRTO Start timeout BOOL 0
STPTO Stop timeout BOOL 0
LOCKD_O Locked output BOOL 0
R_CUR_T Run current time (in seconds) REAL 0.0
S_CUR_T Stop current time (in seconds) REAL 0.0
10-18 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
10.6 MUD (User-defined Motor)
For a general discussion of user-defined devices, see Section 7.4.
The MUD device (FB370) is a two-state motor (running and stopped) and iscontrolled by two discrete signals with a single discrete feedback signal.
The MUD is essentially the shell of a MDS device. The code which definesthe MDS has been reduced to a minimum, and input/output elements havebeen provided to allow you to create your own customized motor andtranslate it for OSx.
The MUD has two alarm timers. When the SRESET (RRESET) inputtransitions from false to true, the alarm timer S_CUR_T (R_CUR_T) starts.When the timer times out, the STRTO (STPTO) output becomes true, andremains true until the SRESET (RRESET) input becomes false.
When you use an MUD device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
10-19SIMATIC PCS 7 OSx 4.1.2 Library Motors
The MUD function block is shown in Figure 10-5, and its inputs and outputsare described in Table 10-11 and Table 10-12.
OB351
BO EN
motor_27
MUD
ENO BO1
User Defined Motor
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTS
BO RESET
R R_ALRM_T
R S_ALRM_T
BO LOCKD
CMMD BO
STRTC BO
RUNNG BO
STPPD BO
TRVL BO
FTR BO
0
0
0
0
0
0
0
0
0
0
1.0
1.0
FTS BO
STRTO BO
STPTO BO
R_CUR_T R
LOCKD_O BO
0
0.1
BO RTR
0
BO MSTRT
BO RRESET
BO SRESET
STOPC BO
BO RUNIO
0
BO OVRD
S_CUR_T R
Figure 10-5 MUD Block
The MUD Block
10-20 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
MUD (continued)
Table 10-11 Input Table for MUD
Element Description Type InitialValue
EN Enable BOOL 1
RUNIO Run feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTR Request to start motor BOOL 0
RTS Request to stop motor BOOL 0
RESET Clear feedback override BOOL 0
MSTRT Manual start BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
R_ALRM_T Run alarm time (in seconds) REAL 1.0
S_ALRM_T Stop alarm time (in seconds) REAL 1.0
OVRD Override feedback BOOL 0
RRESET Run alarm timer reset BOOL 0
SRESET Stop alarm timer reset BOOL 0
10-21SIMATIC PCS 7 OSx 4.1.2 Library Motors
Table 10-12 Output Table for MUD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Start/stop command BOOL 0
STRTC Start command BOOL 0
STOPC Stop command BOOL 0
RUNNG Running BOOL 0
STPPD Stopped BOOL 0
TRVL Traveling BOOL 0
FTR Fail to run BOOL 0
FTS Fail to stop BOOL 0
STRTO Start timeout BOOL 0
STPTO Stop timeout BOOL 0
LOCKD_O Locked output BOOL 0
R_CUR_T Run current time (in seconds) REAL 0.0
S_CUR_T Stop current time (in seconds) REAL 0.0
10-22 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
10.7 RM1 (Reversible Motor/Type 1)
The RM1 device (FB366) is a three-state motor (forward, reverse, andstopped) and is controlled by two discrete control signals with two discretefeedback signals.
The two control signals consist of a forward signal SFWRD and a reversesignal SREV. The two signals cannot both be true at the same time.
• If the desired state of the motor is running forward (MSTRT=true andMREV=false), the SFWRD output is set to true (energized) to start themotor in a forward direction.
• If the desired state of the motor is running reverse (MSTRT=true andMREV=true), the SREV output is set to true (energized) to start themotor in a reverse direction.
• If the desired state of the motor is stopped (MSTRT=false), the currentlyenergized signal (SFWRD or SREV) is set to false.
• The motor, when receiving a start signal, starts running and keepsrunning until the currently energized signal becomes false.
• If you request a change in direction while the motor is running, theDRV output is set to false, and the motor must stop before the directionis changed. After the motor stops, the DRV output is set to true to startthe motor in the new direction.
• The RESET input clears the OVRD input and resets the alarm timers.The alarm timer (R_ALRM_T or S_ALRM_T) starts counting down whenthe RESET input goes false. If the FIO or RIO feedback does not reflectthe correct state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDF and OVRDR inputs.
The two feedback signals consist of a running-forward feedback signal (FIO)and a running-reverse feedback signal (RIO).
• The FIO input is expected to be true when the motor is running in aforward direction and false when it is not.
• The RIO input is expected to be true when the motor is running in areverse direction and false when it is not.
Overview
10-23SIMATIC PCS 7 OSx 4.1.2 Library Motors
In manual mode, the forward and reverse signals (SFWRD/SREV) are set tothe appropriate state based on the status of the MREV and the MSTRTelements, which you manipulate from an operator station or from theprogram.
In auto mode, the RFWRD, RREV, and RSTOP inputs set the state of theseelements, as follows:
RFWRD sets MSTRT=1 and MREV=0
RREV sets MSTRT=1 and MREV=1
RSTOP sets MSTRT=0 and leaves MREV in its last state
In this mode, the MREV and MSTRT inputs are set to reflect the lastrequested state. This is done to provide for a bumpless transfer if the devicechanges modes.
When you use an RM1 device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
10-24 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
RM1 (continued)
The RM1 function block is shown in Figure 10-6, and its inputs and outputsare described in Table 10-13 and Table 10-14.
OB351
BO EN
remo_4
RM1
ENO BO1
Reversible Mot
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RREV
BO RESET
R R_ALRM_T
BO LOCKD
SFWRD BO
RUNNG BO
RUNF BO
RUNR BO
0
0
0
0
0
0
0
1.0
0
0
0.1
0
0
0
BO RFWRD
1.0
BO MSTRT
SREV BO
FTR BO
FTS BO
STRTO BO
STPTO BO
R_CUR_T R
STPPD BO
BO FIO
BO RIO
FTRF BO
FTRR BO
FAILD BO
BO MREV
BO RSTOP
R S_ALRM_T
0
TRVL BO
0
0
BO OVRDF
BO OVRDR
LOCKD_O BO
DRV BO
0 BO IGN_OVRD
S_CUR_T R
Figure 10-6 RM1 Block
The RM1 Block
10-25SIMATIC PCS 7 OSx 4.1.2 Library Motors
Table 10-13 Input Table for RM1
Element Description Type InitialValue
EN Enable BOOL 1
FIO Forward feedback BOOL 0
RIO Reverse feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RFWRD Request to run forward BOOL 0
RREV Request to run reverse BOOL 0
RSTOP Request to stop motor BOOL 0
RESET Clear feedback overrides BOOL 0
MSTRT Manual start BOOL 0
MREV Manual reverse BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
R_ALRM_T Run alarm time (in seconds) REAL 1.0
S_ALRM_T Stop alarm time (in seconds) REAL 1.0
OVRDF Override forward feedback BOOL 0
OVRDR Override reverse feedback BOOL 0
IGN_OVRD Ignore override feedback BOOL 0
10-26 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
RM1 (continued)
Table 10-14 Output Table for RM1
Element Description Type InitialValue
ENO Output valid BOOL 0
SFWRD Forward command BOOL 0
SREV Reverse command BOOL 0
DRV Drive status BOOL 0
RUNNG Running BOOL 0
RUNF Running forward BOOL 0
RUNR Running reverse BOOL 0
STPPD Stopped BOOL 0
TRVL Traveling BOOL 0
FTR Fail to run BOOL 0
FTRF Fail to run forward BOOL 0
FTRR Fail to run reverse BOOL 0
FTS Fail to stop BOOL 0
FAILD Failed BOOL 0
STRTO Start timeout BOOL 0
STPTO Stop timeout BOOL 0
LOCKD_O Locked output BOOL 0
R_CUR_T Run current time (in seconds) REAL 0.0
S_CUR_T Stop current time (in seconds) REAL 0.0
10-27SIMATIC PCS 7 OSx 4.1.2 Library Motors
10.8 RM2 (Reversible Motor/Type 2)
The RM2 device (FB367) is a three-state motor (forward, reverse, andstopped) and is controlled by two discrete control signals with two discretefeedback signals.
The two control signals consist of a start/stop signal DRV and a directionsignal DIR that determines whether the motor runs forward or reverse.
• If the desired state of the motor is running forward (MSTRT=true andMREV=false), the DRV output is set to true and the DIR output to false.
• If the desired state of the motor is running reverse (MSTRT=true andMREV=true), the DRV and DIR outputs are both set to true.
• If the desired state of the motor is stopped (MSTRT=false), the DRVoutput is set to false to stop the motor.
• The motor, when receiving a start signal, starts running and keepsrunning until DRV becomes false or DIR changes state.
• If you request a change in direction while the motor is running, theDRV output is set to false, and the motor must stop before the directionis changed. After the motor stops, the DRV output is set to true to startthe motor in the new direction.
• The RESET input clears the OVRD input and resets the alarm timers.The alarm timer (R_CUR_T or S_CUR_T) starts counting down when theRESET input goes false. If the FIO or RIO feedback does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDF and OVRDR inputs.
The two feedback signals consist of a running-forward feedback signal (FIO)and a running-reverse feedback signal (RIO).
• The FIO input is expected to be true when the motor is running in aforward direction and false when it is not.
• The RIO input is expected to be true when the motor is running in areverse direction and false when it is not.
Overview
10-28 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
RM2 (continued)
In manual mode, the control signals (DRV/DIR) are set to the appropriatestate based on the status of the MREV and the MSTRT inputs, which youmanipulate from an operator station or from the program.
In auto mode, the RFWRD, RREV, and RSTOP inputs set the state of theseelements, as follows:
RFWRD sets MSTRT=1 and MREV=0
RREV sets MSTRT=1 and MREV=1
RSTOP sets MSTRT=0 and leaves MREV in its last state
In this mode, the MREV and MSTRT inputs are set to reflect the lastrequested state. This is done to provide for a bumpless transfer if the devicechanges modes.
When you use an RM2 device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
10-29SIMATIC PCS 7 OSx 4.1.2 Library Motors
The RM2 function block is shown in Figure 10-7, and its inputs and outputsare described in Table 10-15 and Table 10-16.
OB351
remo_5
RM2
ENO BO
Reversible Mot
DRV BO
DIR BO
RUNNG BO
RUNF BO
RUNR BO
FTR BO
FTS BO
STRTO BO
STPTO BO
R_CUR_T R
LOCKD_O BO
STPPD BO
FTRF BO
FTRR BO
FAILD BO
TRVL BO
BO EN1
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RREV
BO RESET
R R_ALRM_T
BO LOCKD
0
0
0
0
0
0
0
1.0
0
0
0.1
0
0
0
BO RFWRD
1.0
BO MSTRT
BO FIO
BO RIO
BO MREV
BO RSTOP
R S_ALRM_T
0
0
0
BO OVRDF
BO OVRDR
0 BO IGN_OVRD
S_CUR_T R
Figure 10-7 RM2 Block
The RM2 Block
10-30 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
RM2 (continued)
Table 10-15 Input Table for RM2
Element Description Type InitialValue
EN Enable BOOL 1
FIO Forward feedback BOOL 0
RIO Reverse feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RFWRD Request to run forward BOOL 0
RREV Request to run reverse BOOL 0
RSTOP Request to stop motor BOOL 0
RESET Clear feedback overrides BOOL 0
MSTRT Manual start BOOL 0
MREV Manual reverse BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
R_ALRM_T Run alarm time (in seconds) REAL 1.0
S_ALRM_T Stop alarm time (in seconds) REAL 1.0
OVRDF Override forward feedback BOOL 0
OVRDR Override reverse feedback BOOL 0
IGN_OVRD Ignore override feedback BOOL 0
10-31SIMATIC PCS 7 OSx 4.1.2 Library Motors
Table 10-16 Output Table for RM2
Element Description Type InitialValue
ENO Output valid BOOL 0
DRV Start/stop command BOOL 0
DIR Direction: 1=reverse, 0=forward BOOL 0
RUNNG Running BOOL 0
RUNF Running forward BOOL 0
RUNR Running reverse BOOL 0
STPPD Stopped BOOL 0
TRVL Traveling BOOL 0
FTR Fail to run BOOL 0
FTS Fail to stop BOOL 0
FTRF Fail to run forward BOOL 0
FTRR Fail to run reverse BOOL 0
FAILD Failed BOOL 0
STRTO Start timeout BOOL 0
STPTO Stop timeout BOOL 0
LOCKD_O Locked output BOOL 0
R_CUR_T Run current time (in seconds) REAL 0.0
S_CUR_T Stop current time (in seconds) REAL 0.0
10-32 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
10.9 TS1 (Two-Speed Motor/Type 1)
The TS1 device (FB368) is a three-state motor (high, low, and stopped) andis controlled by two discrete control signals with two discrete feedbacksignals.
The two discrete control signals consist of a low signal (SLOW) and a highsignal (SHIGH). The two signals cannot both be true at the same time.
• If the desired state of the motor is running at high speed (MSTRT=trueand MHIGH=true), the SHIGH output is set to true (energized) to startthe motor at high speed.
• If the desired state of the motor is running at low speed (MSTRT=trueand MHIGH=false), the SLOW bit is set to true (energized) to start themotor at slow speed.
• If the desired state is stopped (MSTRT=false), the currently energizedsignal (SHIGH or SLOW) is set to false.
• The motor, when receiving a start signal, starts running and keepsrunning until the currently energized signal becomes false.
• You can change the speed of a two-speed motor without stopping it.
• The RESET input clears the OVRDH/OVRDL input and resets the alarmtimers. The alarm timer (R_CUR_T or S_CUR_T) starts counting downwhen the RESET input goes false. If the HIO or LIO feedback does notreflect the correct state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDH and OVRDL inputs.
The two feedback signals consist of a running-low feedback signal (LIO) anda running-high feedback signal (HIO).
• The LIO input is expected to be true when the motor is running at lowspeed and false when it is not.
• The HIO input is expected to be true when the motor is running at highspeed and false when it is not.
• If you set SAME_FBK to true, only the LIO feedback will be active. Anyfeedback connections must then be made to the LIO input.
Overview
10-33SIMATIC PCS 7 OSx 4.1.2 Library Motors
In manual mode, the outputs (SLOW/SHIGH) are set to the appropriate statebased on the status of the MHIGH and the MSTRT inputs, which you canmanipulate from an operator station or from the program.
In auto mode, the RLOW, RHIGH, and RSTOP inputs set the state of theseelements, as follows:
RLOW sets MSTRT=1 and MHIGH=0
RHIGH sets MSTRT=1 and MHIGH=1
RSTOP sets MSTRT=0 and leaves MHIGH in its last state
In this mode, the MHIGH and MSTRT inputs are set to reflect the lastrequested state. This is done to provide for a bumpless transfer if the devicechanges modes.
When you use a TS1 device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
10-34 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
TS1 (continued)
The TS1 function block is shown in Figure 10-8, and its inputs and outputsare described in Table 10-17 and Table 10-18.
OB351
BO EN
2mo_1
TS1
ENO BO1
Two Speed/Type1
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RLOW
BO RESET
R R_ALRM_T
BO LOCKD
SHIGH BO
SLOW BO
RUNNG BO
RUNH BO
RUNL BO
0
0
0
0
0
0
0
0
0
0
1.0
0
0
0
BO RHIGH
1.0
BO MSTRT
FTR BO
FTS BO
STRTO BO
STPTO BO
R_CUR_T R
LOCKD_O BO
STPPD BO
BO HIO
BO LIO
FTRH BO
FTRL BO
FAILD BO
BO MHIGH
BO RSTOP
R S_ALRM_T
0.1
TRVL BO
0
BO SAME_FBK
0
0
BO OVRDH
BO OVRDL
BO IGN_OVRD
0
S_CUR_T R
Figure 10-8 TS1 Block
The TS1 Block
10-35SIMATIC PCS 7 OSx 4.1.2 Library Motors
Table 10-17 Input Table for TS1
Element Description Type InitialValue
EN Enable BOOL 1
HIO High feedback BOOL 0
LIO Low feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RHIGH Request to run high BOOL 0
RLOW Request to run low BOOL 0
RSTOP Request to stop motor BOOL 0
RESET Clear feedback overrides BOOL 0
MSTRT Manual start BOOL 0
MHIGH Manual high BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
R_ALRM_T Run alarm time (in seconds) REAL 1.0
S_ALRM_T Stop alarm time (in seconds) REAL 1.0
OVRDH Override high feedback BOOL 0
OVRDL Override low feedback BOOL 0
IGN_OVRD Ignore override feedback BOOL 0
SAME_FBK Same feedback (HIO=LIO) BOOL 0
10-36 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
TS1 (continued)
Table 10-18 Output Table for TS1
Element Description Type InitialValue
ENO Output valid BOOL 0
SHIGH Start high command BOOL 0
SLOW Start low command BOOL 0
RUNNG Running BOOL 0
RUNH Running high BOOL 0
RUNL Running low BOOL 0
STPPD Stopped BOOL 0
TRVL Traveling BOOL 0
FTR Fail to run BOOL 0
FTRH Fail to run high BOOL 0
FTRL Fail to run low BOOL 0
FTS Fail to stop BOOL 0
FAILD Failed BOOL 0
STRTO Start timeout BOOL 0
STPTO Stop timeout BOOL 0
LOCKD_O Locked output BOOL 0
R_CUR_T Run current time (in seconds) REAL 0.0
S_CUR_T Stop current time (in seconds) REAL 0.0
10-37SIMATIC PCS 7 OSx 4.1.2 Library Motors
10.10 TS2 (Two-Speed Motor/Type 2)
The TS2 device (FB369) is a three-state motor (high, low, and stopped) andis controlled by two discrete control signals with two discrete feedbacksignals.
The two discrete control signals consist of a start/stop signal (DRV) and aspeed signal (SPEED) that determines whether the motor runs at high or lowspeed.
• If the desired state of the motor is running high (MSTRT=true andMHIGH=true), the DRV and SPEED outputs are both set to true.
• If the desired state is running low (MSTRT=true and MHIGH=false), theDRV output is set to true and the SPEED output is set to false.
• If the desired state is stopped (MSTRT=false), the DRV output is set tofalse to stop the motor.
• The motor, when receiving a start signal, starts running and keepsrunning until DRV becomes false.
• You can change the speed of a two-speed motor without stopping it.
• The RESET input clears the OVRD input and resets the alarm timers.The alarm timer (R_CUR_T or S_CUR_T) starts counting down when theRESET input goes false. If the HIO or LIO feedback does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDH and OVRDL inputs.
The two feedback signals consist of a running-low feedback signal (LIO) anda running-high feedback signal (HIO).
• The LIO input is expected to be true when the motor is running at lowspeed and false when it is not.
• The HIO input is expected to be true when the motor is running at highspeed and false when it is not.
• If you set SAME_FBK to true, only the LIO feedback will be active. Anyfeedback connections must then be made to the LIO input.
Overview
10-38 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
TS2 (continued)
In manual mode, the outputs (DRV/SPEED) are set to the appropriate statebased on the status of the MHIGH and the MSTRT inputs, which you canmanipulate from an operator station or from the program.
In auto mode, the RLOW, RHIGH, and RSTOP inputs set the state of theseelements, as follows:
RLOW sets MSTRT=1 and MHIGH=0
RHIGH sets MSTRT=1 and MHIGH=1
RSTOP sets MSTRT=0 and leaves MHIGH in its last state
In this mode, the MHIGH and MSTRT inputs are set to reflect the lastrequested state. This is done to provide for a bumpless transfer if the devicechanges modes.
When you use a TS2 device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
10-39SIMATIC PCS 7 OSx 4.1.2 Library Motors
The TS2 function block is shown in Figure 10-9, and its inputs and outputsare described in Table 10-19 and Table 10-20.
OB351
2mo_2
TS2
ENO BO
Two Speed/Type 2
DRV BO
SPEED BO
RUNNG BO
RUNH BO
RUNL BO
FTR BO
FTS BO
STRTO BO
STPTO BO
R_CUR_T R
LOCKD_O BO
STPPD BO
FTRH BO
FTRL BO
FAILD BO
TRVL BO
BO EN1
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RLOW
BO RESET
R R_ALRM_T
BO LOCKD
0
0
0
0
0
0
0
0
0
0
1.0
0
0
0
BO RHIGH
1.0
BO MSTRT
BO HIO
BO LIO
BO MHIGH
BO RSTOP
R S_ALRM_T
0.1
0
BO SAME_FBK
0
0
BO OVRDH
BO OVRDL
BO IGN_OVRD
0
S_CUR_T R
Figure 10-9 TS2 Block
The TS2 Block
10-40 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
TS2 (continued)
Table 10-19 Input Table for TS2
Element Description Type InitialValue
EN Enable BOOL 1
HIO High feedback BOOL 0
LIO Low feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RHIGH Request to run high BOOL 0
RLOW Request to run low BOOL 0
RSTOP Request to stop motor BOOL 0
RESET Clear feedback overrides BOOL 0
MSTRT Manual start BOOL 0
MHIGH Manual high BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
R_ALRM_T Run alarm time (in seconds) REAL 1.0
S_ALRM_T Stop alarm time (in seconds) REAL 1.0
OVRDH Override high feedback BOOL 0
OVRDL Override low feedback BOOL 0
IGN_OVRD Ignore override feedback BOOL 0
SAME_FBK Same feedback (LIO=HIO) BOOL 0
10-41SIMATIC PCS 7 OSx 4.1.2 Library Motors
Table 10-20 Output Table for TS2
Element Description Type InitialValue
ENO Output valid BOOL 0
DRV Start/stop command BOOL 0
SPEED Speed: 1=high, 0=low BOOL 0
RUNNG Running BOOL 0
RUNH Running high BOOL 0
RUNL Running low BOOL 0
STPPD Stopped BOOL 0
TRVL Traveling BOOL 0
FTR Fail to run BOOL 0
FTRH Fail to run high BOOL 0
FTRL Fail to run low BOOL 0
FTS Fail to stop BOOL 0
FAILD Failed BOOL 0
STRTO Start timeout BOOL 0
STPTO Stop timeout BOOL 0
LOCKD_O Locked output BOOL 0
R_CUR_T Run current time (in seconds) REAL 0.0
S_CUR_T Stop current time (in seconds) REAL 0.0
10-42 SIMATIC PCS 7 OSx 4.1.2 LibraryMotors
Cylinders 11-1SIMATIC PCS 7 OSx 4.1.2 Library
Chapter 11
Cylinders
11.1 Cylinder Inputs and Outputs 11-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2 CSD (Single-Drive/Dual-Feedback Cylinder) 11-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3 CUD (User-defined Cylinder) 11-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Cylinders11-2 SIMATIC PCS 7 OSx 4.1.2 Library
11.1 Cylinder Inputs and Outputs
Table 11-1 and Table 11-2 list the input and output elements for cylinderdevices and show the types of cylinders that use each element.
Table 11-1 Cylinder Inputs
Element Description Cylinder Types
EN Enable CSD CUD
ELS Extended feedback CSD CUD
RLS Retracted feedback CSD CUD
RTL Request to lock (place in auto mode) CSD CUD
RTU Request to unlock (place in manual mode) CSD CUD
RTE Request to extend cylinder CSD CUD
RTR Request to retract cylinder CSD CUD
RESET Clear feedback overrides CSD CUD
MEXTEND Manual extend CSD CUD
DSBLD Forced to manual mode CSD CUD
LOCKD Locked (auto mode) CSD CUD
NRDY Not ready CSD CUD
SAMPLE_T Sample time (in seconds) CSD CUD
E_ALRM_T Extend alarm time (in seconds) CSD CUD
R_ALRM_T Retract alarm time (in seconds) CSD CUD
E_STATE Energize state: 1=extended, 0=retracted CSD
OVRDE Override extend feedback CSD CUD
OVRDR Override retract feedback CSD CUD
IGN_OVRD Ignore feedback override CSD
CLR_CMMD Clear CMMD on FTE/FTR CSD
ERESET Extend reset CUD
RRESET Retract reset CUD
Cylinders 11-3SIMATIC PCS 7 OSx 4.1.2 Library
Table 11-2 Cylinder Outputs
Element Description Cylinder Types
ENO Output valid CSD CUD
CMMD Extend/retract command CSD CUD
EXTC Extend command CUD
RETC Retract command CUD
EXTENDED Extended CSD CUD
RETRACTED Retracted CSD CUD
TRVL Traveling CSD CUD
FTE Fail to extend CSD CUD
FTR Fail to retract CSD CUD
FAILD Failed CSD CUD
EXTTO Extend timeout CUD
RETTO Retract timeout CUD
LOCKD_O Locked output CSD CUD
E_CUR_T Extend current time (in seconds) CSD CUD
R_CUR_T Retract current time (in seconds) CSD CUD
Cylinders11-4 SIMATIC PCS 7 OSx 4.1.2 Library
11.2 CSD (Single-Drive/Dual-Feedback Cylinder)
The CSD (FB371) device has two positions (extended and retracted) and iscontrolled by a single discrete signal with two discrete feedback signals. Twotypes of CSD device control are supported: energize-extend andenergize-retract. You can select the type of CSD device control you want bysetting the E_STATE input to 1 (energize-extend) or 0 (energize-retract).Energize-extend is the default.
One control signal (CMMD) determines the state of the cylinder.
• If the desired state of an energize-extend cylinder is extended(MEXTEND=true), the control signal CMMD is set to true.
If the desired state is retracted, (MEXTEND=false), the CMMD output isset to false.
• If the desired state of an energize-retract cylinder is extended(MEXTEND=true), the control signal CMMD is set to false.
If the desired state is retracted, (MEXTEND=false), the CMMD output isset to true.
• The RESET input clears the OVRDE (OVRDR) input and resets the alarmtimer. The alarm timer E_ALRM_T (for energize-extend cylinders) orR_ALRM_T (for energize-retract cylinders) starts counting down whenthe RESET input goes false. If the ELS (RLS) feedback does not reflectthe correct state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDE and OVRDR inputs.
For both types of cylinders, the two feedback signals consist of an extendedfeedback signal (ELS) and a retracted feedback signal (RLS).
• The ELS input should be true when the piston is extended and falsewhen it is retracted.
• The RLS input should be true when the piston is retracted and falsewhen it is extended.
Overview
Cylinders 11-5SIMATIC PCS 7 OSx 4.1.2 Library
When you use a CSD device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
Cylinders11-6 SIMATIC PCS 7 OSx 4.1.2 Library
CSD (continued)
The CSD function block is shown in Figure 11-1, and its inputs and outputsare described in Table 11-3 and Table 11-4.
OB351
BO EN
cyl_6
CSD
ENO BO1
Single-Drive/Du
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTR
BO LOCKD
CMMD BO
EXTENDED BO
RETRACTE BO0
0
0
0
0
0
0
1.0
1.0
0
0
0
0
0
BO RTE
0.1
BO MEXTEND
FTE BO
FTR BO
E_CUR_T R
LOCKD_O BO
BO ELS
BO RLS
FAILD BO
TRVL BO
0
BO OVRDR
BO OVRDE
BO E_STATE
BO IGN_OVRD
BO CLR_CMMD
BO RESET
0
R E_ALRM_T
1
R R_ALRM_T
0
R_CUR_T R
Figure 11-1 CSD Block
The CSD Block
Cylinders 11-7SIMATIC PCS 7 OSx 4.1.2 Library
Table 11-3 Input Table for CSD
Element Description Type InitialValue
EN Enable BOOL 1
ELS Extend feedback BOOL 0
RLS Retract feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTE Request to extend cylinder BOOL 0
RTR Request to retract cylinder BOOL 0
RESET Clear feedback overrides BOOL 0
MEXTEND Manual extend BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
E_ALRM_T Extend alarm time (in seconds) REAL 1.0
R_ALRM_T Retract alarm time (in seconds) REAL 1.0
E_STATE Energize state: 1=extended; 0=retracted BOOL 1
OVRDE Override extend feedback BOOL 0
OVRDR Override retract feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
CLR_CMMD Clear CMMD on FTE/FTR BOOL 0
Cylinders11-8 SIMATIC PCS 7 OSx 4.1.2 Library
CSD (continued)
Table 11-4 Output Table for CSD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Extend/retract command BOOL 0
EXTENDED Extended BOOL 0
RETRACTED Retracted BOOL 0
TRVL Traveling BOOL 0
FTE Fail to extend BOOL 0
FTR Fail to retract BOOL 0
FAILD Failed BOOL 0
LOCKD_O Locked output BOOL 0
E_CUR_T Extend current time (in seconds) REAL 0.0
R_CUR_T Retract current time (in seconds) REAL 0.0
Cylinders 11-9SIMATIC PCS 7 OSx 4.1.2 Library
11.3 CUD (User-defined Cylinder)
For a general discussion of user-defined devices, see Section 7.4.
The CUD (FB372) device has two positions (extended and retracted) and iscontrolled by two discrete signals with two discrete feedback signals.
The CUD is essentially the shell of a CSD device. The code that defines theCSD has been reduced to a minimum, and input/output elements areprovided to allow you to create your own customized cylinder and translateit for OSx.
The CUD has two alarm timers. When the ERESET (RRESET) inputtransitions from false to true, the alarm timer starts. When the timer timesout, the EXTTO (RETTO) output becomes true, and remains true until theERESET (RRESET) input becomes false.
When you use a CUD device, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
Cylinders11-10 SIMATIC PCS 7 OSx 4.1.2 Library
CUD (continued)
The CUD function block is shown in Figure 11-2, and its inputs and outputsare described in Table 11-5 and Table 11-6.
OB351
BO EN
cyl_7
CUD
ENO BO1
User Designed
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTR
BO LOCKD
CMMD BO
EXTENDED BO
RETRACTE BO
0
0
0
0
0
0
0
0
0
0
0
0
BO RTE
0.1
BO MEXTEND
FTE BO
FTR BO
BO ELS
BO RLS
FAILD BO
TRVL BO
BO OVRDR
BO OVRDE
BO RESET
0
EXTTO BO
RETTO BO
EXTC BO
RETC BO
1.0
R E_ALRM_T1.0
R R_ALRM_T
BO ERESET
BO RRESET
E_CUR_T R
LOCKD_O BO
0
0
R_CUR_T R
Figure 11-2 CUD Block
The CUD Block
Cylinders 11-11SIMATIC PCS 7 OSx 4.1.2 Library
Table 11-5 Input Table for CUD
Element Description Type InitialValue
EN Enable BOOL 1
ELS Extend feedback BOOL 0
RLS Retract feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTE Request to extend piston BOOL 0
RTR Request to retract piston BOOL 0
RESET Clear feedback overrides BOOL 0
MEXTEND Manual extend BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
E_ALRM_T Extend alarm time (in seconds) REAL 1.0
R_ALRM_T Retract alarm time (in seconds) REAL 1.0
OVRDE Override extend feedback BOOL 0
OVRDR Override retract feedback BOOL 0
ERESET Extend alarm timer reset BOOL 0
RRESET Retract alarm timer reset BOOL 0
Cylinders11-12 SIMATIC PCS 7 OSx 4.1.2 Library
CUD (continued)
Table 11-6 Output Table for CUD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Extend/retract command BOOL 0
EXTC Extend command BOOL 0
RETC Retract command BOOL 0
EXTENDED Extended BOOL 0
RETRACTE Retracted BOOL 0
TRVL Traveling BOOL 0
FTE Fail to extend BOOL 0
FTR Fail to retract BOOL 0
FAILD Failed BOOL 0
EXTTO Extend timeout BOOL 0
RETTO Retract timeout BOOL 0
LOCKD_O Locked output BOOL 0
E_CUR_T Extend current time (in seconds) REAL 0.0
R_CUR_T Retract current time (in seconds) REAL 0.0
12-1SIMATIC PCS 7 OSx 4.1.2 Library Presses
Chapter 12
Presses
12.1 Press Inputs and Outputs 12-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.2 PND (Hand-Operated/Dual-Feedback Press) 12-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.3 PSN (Single-Drive/Null-Feedback Press) 12-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4 PSS (Single-Drive/Single-Feedback Press) 12-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.5 PSD (Single-Drive/Dual-Feedback Press) 12-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.6 PDD (Dual-Drive/Dual-Feedback Press) 12-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.7 PMD (Motor-Drive/Dual-Feedback Press) 12-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.8 PUD (User-defined Press) 12-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.9 PS1 (Three-Position Press/Type 1) 12-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.10 PS2 (Three-Position Press/Type 2) 12-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12-2 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
12.1 Press Inputs and Outputs
Table 12-1 and Table 12-2 list the input and output elements for pressdevices and show the types of presses that use each element.
Table 12-1 Press Inputs
Element Description Press Types
EN Enable PND PSN PSS PSD PDD PMD PS1/2 PUD
UDLS Up/down feedback PSS
ULS Up feedback PND PSD PDD PMD PUD
DLS Down feedback PND PSD PDD PMD PUD
HIO Up high feedback PS1/2
LIO Up low feedback PS1/2
RTL Request to lock (place in automode) PSN PSS PSD PDD PMD PS1/2 PUD
RTU Request to unlock (place inmanual mode) PSN PSS PSD PDD PMD PS1/2 PUD
RTO Request to raise press PSN PSS PSD PDD PMD PUD
RTOA Request to raise option A, H PUD
RTOB Request to raise option B, L PUD
RHIGH Request to raise high PS1/2 PUD
RLOW Request to raise low PS1/2 PUD
RTC Request to lower press PSN PSS PSD PDD PMD PS1/2 PUD
RTS Request to stop the press motor PMD
RESET Clear feedback overrides PSS PSD PDD PMD PS1/2 PUD
MRAISE Manual raise PND PSN PSS PSD PDD PMD PS1/2 PUD
MHIGH Manual high PS1/2
DSBLD Forced to manual mode PSN PSS PSD PDD PMD PS1/2 PUD
LOCKD Locked (auto mode) PSN PSS PSD PDD PMD PS1/2 PUD
NRDY Not ready PSN PSS PSD PDD PMD PS1/2 PUD
SAMPLE_T Sample time (in seconds) PSN PSS PSD PDD PMD PS1/2 PUD
U_ALRM_T Up alarm time (in seconds) PSN PSS PSD PDD PMD PS1/2 PUD
D_ALRM_T Down alarm time (in seconds) PSN PSS PSD PDD PMD PS1/2 PUD
E_STATE Energize state 1=up; 0=down PSN PSS PSD
Table continues on next page.
12-3SIMATIC PCS 7 OSx 4.1.2 Library Presses
Table 12-1 Press Inputs (continued)
Element Description Press Types
OVRD Override feedback PSS
OVRDU Override up feedback PSD PDD PMD PUD
OVRDD Override down feedback PSD PDD PMD PUD
OVRDH Override high, option H feedback PS1/2
OVRDL Override low, option L feedback PS1/2
IGN_OVRD Ignore feedback override PSS PSD PDD PMD PS1/2
CLR_CMMD Clear CMMD on FTR/FTL PSS PSD
SAME_FBK Same feedback (LIO=HIO) PS1/2
URESET Raise reset PUD
DRESET Lower reset PUD
12-4 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
Press Inputs and Outputs (continued)
Table 12-2 Press Outputs
Element Description Press Types
ENO Output valid PND PSN PSS PSD PDD PMD PS1/2 PUD
CMMD Raise/lower command PSN PSS PSD PDD PMD PUD
UPC Raise command PDD PMD PUD
DOWNC Lower command PDD PMD PUD
SHIGH Raise high PS1
SLOW Raise low PS1
DRV Raise command PS2
POS Raise position PS2
UP Up PND PSN PSS PSD PDD PMD PS1/2 PUD
UPA Up option A PUD
UPB Up option B PUD
UPH Up high, option H PS1/2
UPL Up low, option L PS1/2
DOWN Down PND PSN PSS PSD PDD PMD PS1/2 PUD
TRVL Traveling PSN PSS PSD PDD PMD PS1/2 PUD
FTR Fail to raise PSS PSD PDD PMD PS1/2 PUD
FTRH Fail to raise high PS1/2
FTRL Fail to raise low PS1/2
FTL Fail to lower PSS PSD PDD PMD PS1/2 PUD
FAILD Failed PND PSD PDD PMD PS1/2 PUD
UPTO Up timeout PDD PMD PS1/2 PUD
DOWNTO Down timeout PDD PMD PS1/2 PUD
LOCKD_O Locked output PSN PSS PSD PDD PMD PS1/2 PUD
U_CUR_T Up current time (in seconds) PSN PSS PSD PDD PMD PS1/2 PUD
D_CUR_T Down current time (in seconds) PSN PSS PSD PDD PMD PS1/2 PUD
12-5SIMATIC PCS 7 OSx 4.1.2 Library Presses
12.2 PND (Hand-Operated/Dual-Feedback Press)
The PND device (FB355) has two positions (up and down) and is controlledby two discrete feedback signals.
The two feedback signals consist of an up feedback signal (ULS) and a downfeedback signal (DLS).
• The ULS input is expected to be true when the press is up and falsewhen it is down.
• The DLS input is expected to be true when the press is down and falsewhen it is up.
The MRAISE extension shows the state of the press.
• If the press is up (ULS=true), the control signal MRAISE is set to true.
• If the desired state is down (DLS=true), MRAISE is set to false.
When you use a PND device, the following function blocks must be presentin the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
12-6 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PND (continued)
The PND function block is shown in Figure 12-1, and its inputs and outputsare described in Table 12-3 and Table 12-4.
1
0
0
press_3
PNDHand Operated/Du OB35
1
ENO BO
UP BO
DOWN BO
FAILD BO
BO EN
BO ULS
BO DLS
MRAISE BO
Figure 12-1 PND Block
Table 12-3 Input Table for PND
Element Description Type InitialValue
EN Enable BOOL 1
ULS Up feedback BOOL 0
DLS Down feedback BOOL 0
Table 12-4 Output Table for PND
Element Description Type InitialValue
ENO Output valid BOOL 0
MRAISE Manual raise BOOL 0
UP Up BOOL 0
DOWN Down BOOL 0
FAILD Failed BOOL 0
The PND Block
12-7SIMATIC PCS 7 OSx 4.1.2 Library Presses
12.3 PSN (Single-Drive/Null-Feedback Press)
The PSN device (FB356) has two positions (up and down) and is controlledby one discrete signal with no feedback. Two types of PSN device control areavailable: energize-raise and energize-lower. You can select the type of PSNdevice control you want by setting the E_STATE input to 1 (energize-raise) or0 (energize-lower). Energize-raise is the default.
• If the desired state of an energize-raise press is up (MRAISE=true), thefield control signal CMMD is set to true.
If the desired state is down (MRAISE=false), the CMMD output is set tofalse.
• If the desired state of an energize-lower press is up (MRAISE=true), thecontrol signal (CMMD) is set to false.
If the desired state is down (MRAISE=false), the CMMD output is set totrue.
When you use a PSN device, the following function blocks must be presentin the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
12-8 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PSN (continued)
The PSN function block is shown in Figure 12-2, and its inputs and outputsare described in Table 12-5 and Table 12-6.
OB351
BO EN
press_4
PSN
ENO BO1
Single-Drive/Nul
R SAMPLE_T
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
R U_ALRM_T
R D_ALRM_T
BO LOCKD
CMMD BO
TRVL BO
0
0
0
0
1.0
0
1
0.1
1.0
U_CUR_T R
LOCKD_O BO
0
0
BO MRAISE
BO RTO
UP BO
DOWN BO
BO E_STATE
0
D_CUR_T R
Figure 12-2 PSN Block
The PSN Block
12-9SIMATIC PCS 7 OSx 4.1.2 Library Presses
Table 12-5 Input Table for PSN
Element Description Type InitialValue
EN Enable BOOL 1
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to raise press BOOL 0
RTC Request to lower press BOOL 0
MRAISE Manual raise BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
U_ALRM_T Up alarm time (in seconds) REAL 1.0
D_ALRM_T Down alarm time (in seconds) REAL 1.0
E_STATE Energize state: 1=up, 0=down BOOL 0
Table 12-6 Output Table for PSN
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Raise/lower command BOOL 0
UP Up BOOL 0
DOWN Down BOOL 0
TRVL Traveling BOOL 0
LOCKD_O Locked output BOOL 0
U_CUR_T Up current time (in seconds) REAL 0.0
D_CUR_T Down current time (in seconds) REAL 0.0
12-10 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
12.4 PSS (Single-Drive/Single-Feedback Press)
The PSS device (FB353) has two positions (up and down) and is controlledby a single discrete signal with one discrete feedback signal. Two types ofPSS device control are available: energize-raise and energize-lower. You canselect the type of PSS device control you want by setting the E_STATE inputto 1 (energize-raise) or 0 (energize-lower). Energize-raise is the default.
• If the desired state of an energize-raise press is up (MRAISE=true), thefield control signal CMMD is set to true. If the desired state is down(MRAISE=false), the CMMD output is set to false.
• The feedback signal UDLS for the energize-raise press is expected to betrue when the press is up and false when the press is down.
• If the desired state of an energize-lower press is up (MRAISE=true), thecontrol signal (CMMD) is set to false. If the desired state is down(MRAISE=false), the CMMD output is set to true.
• The feedback signal UDLS for the energize-lower press is expected to befalse when the press is up and true when the press is down.
• If the CLR_CMMD input is set to true, the CMMD output will change tofalse when the FTR output becomes true. The CMMD output will remainfalse until RESET is set to true.
• The RESET input clears the OVRD input and resets the alarm timer(U_CUR_T or D_CUR_T). If the UDLS feedback signal does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRD input.
When you use a PSS device, the following function blocks must be presentin the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
12-11SIMATIC PCS 7 OSx 4.1.2 Library Presses
The PSS function block is shown in Figure 12-3, and its inputs and outputsare described in Table 12-7 and Table 12-8.
OB351
BO EN
press_4
PSS
ENO BO1
Single-Drive/Si
R SAMPLE_T
BO UDLS
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
R U_ALRM_T
R D_ALRM_T
BO LOCKD
CMMD BO
TRVL BO
FTR BO
0
0
0
0
0
0
1.0
0
0
0
1
0
FTL BO
U_CUR_T R
LOCKD_O BO
1.0
0
0.1
BO MRAISE
BO OVRD
BO RTO
BO IGN_OVRD
UP BO
DOWN BO
BO RESET
BO CLR_CMMD
0
BO E_STATE
0
D_CUR_T R
Figure 12-3 PSS Block
The PSS Block
12-12 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PSS (continued)
Table 12-7 Input Table for PSS
Element Description Type InitialValue
EN Enable BOOL 1
UDLS Up/down feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to raise press BOOL 0
RTC Request to lower press BOOL 0
RESET Clear feedback override BOOL 0
MRAISE Manual raise BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
U_ALRM_T Up alarm time (in seconds) REAL 1.0
D_ALRM_T Down alarm time (in seconds) REAL 1.0
E_STATE Energize state: 1=up, 0=down BOOL 1
OVRD Override feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
CLR_CMMD Clear CMMD on FTR/FTL BOOL 0
12-13SIMATIC PCS 7 OSx 4.1.2 Library Presses
Table 12-8 Output Table for PSS
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Raise/lower command BOOL 0
UP Up BOOL 0
DOWN Down BOOL 0
TRVL Traveling BOOL 0
FTR Fail to raise BOOL 0
FTL Fail to lower BOOL 0
LOCKD_O Locked output BOOL 0
U_CUR_T Up current time (in seconds) REAL 0.0
D_CUR_T Down current time (in seconds) REAL 0.0
12-14 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
12.5 PSD (Single-Drive/Dual-Feedback Press)
The PSD device (FB354) has two positions (up and down) and is controlledby a single discrete signal with two discrete feedback signals. Two types ofPSD devices are supported: energize-raise and energize-lower. You canselect the type of PSD device control you want by setting the E_STATE inputto 1 (energize-raise) or 0 (energize-lower). Energize-raise is the default.
One control signal (CMMD) determines the state of the press.
• If the desired state of an energize-raise press is up (MRAISE=true), thecontrol signal (CMMD) is set to true.
If the desired state is down (MRAISE=false), the CMMD output is set tofalse.
• If the desired state of an energize-lower press is up (MRAISE=true), thecontrol signal (CMMD) is set to false.
If the desired state is down (MRAISE=false), the CMMD output is set totrue.
• If the CLR_CMMD input is selected, the CMMD output will change tofalse when the FTR output (for energize-raise presses) or FTL output (forenergize-lower presses) becomes true. The CMMD output will remainfalse until a RESET is set to true.
• The RESET input clears the OVRDU and OVRDD inputs and resets thealarm timer (U_CUR_T or D_CUR_T). If the ULS or DLS feedback signaldoes not reflect the correct state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDU and OVRDD inputs.
For both types of presses, the two feedback signals consist of an up feedbacksignal (ULS) and a down feedback signal (DLS).
• The ULS input is expected to be true when the press is up and falsewhen it is down.
• The DLS input is expected to be true when the press is down and falsewhen it is up.
Overview
12-15SIMATIC PCS 7 OSx 4.1.2 Library Presses
When you use a PSD device, the following function blocks must be presentin the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
12-16 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PSD (continued)
The PSD function block is shown in Figure 12-4, and its inputs and outputsare described in Table 12-9 and Table 12-10.
OB351
BO EN
press_5
PSD
ENO BO1
Single-Drive/Du
R SAMPLE_T
BO ULS
BO DLS
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
R U_ALRM_T
R D_ALRM_T
BO LOCKD
CMMD BO
TRVL BO
FTR BO
0
0
0
0
0
0
0
1.0
0
0
0
1
0
FTL BO
FAILD BO
U_CUR_T R
LOCKD_O BO
1.0
0
0.1
BO MRAISE
0
BO OVRDU
BO OVRDD
BO RTO
BO IGN_OVRD
UP BO
DOWN BO
BO RESET
BO CLR_CMMD
0
BO E_STATE
0
D_CUR_T R
Figure 12-4 PSD Block
The PSD Block
12-17SIMATIC PCS 7 OSx 4.1.2 Library Presses
Table 12-9 Input Table for PSD
Element Description Type InitialValue
EN Enable BOOL 1
ULS Up feedback BOOL 0
DLS Down feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to raise press BOOL 0
RTC Request to lower press BOOL 0
RESET Clear feedback overrides BOOL 0
MRAISE Manual raise BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
U_ALRM_T Up alarm time (in seconds) REAL 1.0
D_ALRM_T Down alarm time (in seconds) REAL 1.0
E_STATE Energize state: 1=up; 0=down BOOL 1
OVRDU Override up feedback BOOL 0
OVRDD Override down feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
CLR_CMMD Clear CMMD on FTR/FTL BOOL 0
12-18 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PSD (continued)
Table 12-10 Output Table for PSD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Raise/lower command BOOL 0
UP Up BOOL 0
DOWN Down BOOL 0
TRVL Traveling BOOL 0
FTR Fail to raise BOOL 0
FTL Fail to lower BOOL 0
FAILD Failed (ULS=1 and DLS=1) BOOL 0
LOCKD_O Locked output BOOL 0
U_CUR_T Up current time (in seconds) REAL 0.0
D_CUR_T Down current time (in seconds) REAL 0.0
12-19SIMATIC PCS 7 OSx 4.1.2 Library Presses
12.6 PDD (Dual-Drive/Dual-Feedback Press)
The PDD device (FB357) has two positions (up and down) and is controlledby two discrete signals with two discrete feedback signals.
The two control signals consist of an up signal (UPC) and a down signal(DOWNC), which are both normally false.
• If the desired state is up (MRAISE=true), the UPC output is set to true.The UPC output remains true until either the up feedback signal ULS istrue or the up alarm time U_ALRM_T expires; then UPC is set to false.
• If the desired state is down, the DOWNC output is set to true to lowerthe press. The DOWNC output remains true until either the downfeedback signal DLS is true or the down alarm time D_ALRM_T expires;then DOWNC is set to false.
• The RESET input clears the OVRDU and OVRDD inputs and resets thealarm timer (U_CUR_T or D_CUR_T). If the ULS or DLS feedback signaldoes not reflect the correct state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDU and OVRDD inputs.
The two feedback signals consist of an up feedback signal (ULS) and a downfeedback signal (DLS).
• The ULS input is expected to be true when the press is up and falsewhen it is down.
• The DLS input is expected to be true when the press is down and falsewhen it is up.
When you use a PDD device, the following function blocks must be presentin the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
12-20 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PDD (continued)
The PDD function block is shown in Figure 12-5, and its inputs and outputsare described in Table 12-11 and Table 12-12.
OB351
BO EN
press_6
PDD
ENO BO1
Dual-Drive/Dua
R SAMPLE_T
BO ULS
BO DLS
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
R U_ALRM_T
R D_ALRM_T
BO LOCKD
CMMD BO
UPC BO
DOWNC BO
TRVL BO
FTR BO
0
0
0.1
0
0
0
0
0
0
0
1.0
1.0
FTL BO
FAILD BO
UPTO BO
DOWNTO BO
U_CUR_T R
LOCKD_O BO
0
0
0
BO MRAISE
0
0
BO OVRDU
BO OVRDD
BO RTO
BO IGN_OVRD
UP BO
DOWN BO
BO RESET
D_CUR_T R
Figure 12-5 PDD Block
The PDD Block
12-21SIMATIC PCS 7 OSx 4.1.2 Library Presses
Table 12-11 Input Table for PDD
Element Description Type InitialValue
EN Enable BOOL 1
ULS Up feedback BOOL 0
DLS Down feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to raise press BOOL 0
RTC Request to lower press BOOL 0
RESET Clear feedback overrides BOOL 0
MRAISE Manual raise/lower press BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
U_ALRM_T Up alarm time (in seconds) REAL 1.0
D_ALRM_T Down alarm time (in seconds) REAL 1.0
OVRDU Override up feedback BOOL 0
OVRDD Override down feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
12-22 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PDD (continued)
Table 12-12 Output Table for PDD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Raise/lower press command BOOL 0
UPC Raise press command BOOL 0
DOWNC Lower press command BOOL 0
UP Up BOOL 0
DOWN Down BOOL 0
TRVL Traveling BOOL 0
FTR Fail to raise BOOL 0
FTL Fail to lower BOOL 0
FAILD Failed BOOL 0
UPTO Up timeout BOOL 0
DOWNTO Down timeout BOOL 0
LOCKD_O Locked output BOOL 0
U_CUR_T Up current time (in seconds) REAL 0.0
D_CUR_T Down current time (in seconds) REAL 0.0
12-23SIMATIC PCS 7 OSx 4.1.2 Library Presses
12.7 PMD (Motor-Drive/Dual-Feedback Press)
The PMD device (FB358) has two positions (up and down) and is controlledby two discrete signals with two discrete feedback signals. The two controlsignals consist of a raise signal (UPC) and a lower signal (DOWNC).
• If the desired state of the press is up (MRAISE=true), the UPC output isset to true until the up feedback ULS is true or until the alarm timeU_ALRM_T expires; then UPC is set to false.
• If the desired state is down (MRAISE=false), the DOWNC output is set totrue until down feedback DLS is true or until the alarm time D_ALRM_Texpires; then DOWNC is set to false.
• If the press is stopped in mid-travel (RTS=true), the TRVL outputremains true and the up and down alarm times (U_CUR_T andD_CUR_T) are reset.
• The RESET input clears the OVRDU and OVRDD inputs and resets thealarm timer (U_CUR_T or D_CUR_T). If the ULS or DLS feedback signaldoes not reflect the correct state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDU and OVRDD inputs.
The two feedback signals consist of an up feedback signal (ULS) and a downfeedback signal (DLS).
• The ULS input is expected to be true when the press is up and falsewhen it is down.
• The DLS input is expected to be true when the press is down and falsewhen it is up.
The PMD press can be stopped at any point of its travel by setting the RTSinput to true, which clears both control outputs (UPC and DOWNC).
When you use a PMD device, the following function blocks must be presentin the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
12-24 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PMD (continued)
The PMD function block is shown in Figure 12-6, and its inputs and outputsare described in Table 12-13 and Table 12-14.
OB351
BO EN
press_7
PMD
ENO BO1
Motor Drive/Du
R SAMPLE_T
BO ULS
BO DLS
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
R U_ALRM_T
R D_ALRM_T
BO LOCKD
CMMD BO
UPC BO
DOWNC BO
TRVL BO
FTR BO
0
0
0
0
0
0
0
0
0
0
0
1.0
1.0
FTL BO
FAILD BO
UPTO BO
DOWNTO BO
U_CUR_T R
LOCKD_O BO
0.1
0
0
BO MRAISE
0
BO OVRDU
BO OVRDD
BO RTO
BO IGN_OVRD
UP BO
DOWN BO
BO RESET
BO RTS
0
D_CUR_T R
Figure 12-6 PMD Block
The PMD Block
12-25SIMATIC PCS 7 OSx 4.1.2 Library Presses
Table 12-13 Input Table for PMD
Element Description Type InitialValue
EN Enable BOOL 1
ULS Up feedback BOOL 0
DLS Down feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to raise press BOOL 0
RTC Request to lower press BOOL 0
RTS Request to stop the press motor BOOL 0
RESET Clear feedback overrides BOOL 0
MRAISE Manual raise/lower press BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
U_ALRM_T Up alarm time (in seconds) REAL 1.0
D_ALRM_T Down alarm time (in seconds) REAL 1.0
OVRDU Override up feedback BOOL 0
OVRDD Override down feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
12-26 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PMD (continued)
Table 12-14 Output Table for PMD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Raise/lower command BOOL 0
UPC Raise command BOOL 0
DOWNC Lower command BOOL 0
UP Up BOOL 0
DOWN Down BOOL 0
TRVL Traveling BOOL 0
FTR Fail to raise BOOL 0
FTL Fail to lower BOOL 0
FAILD Failed BOOL 0
UPTO Up timeout BOOL 0
DOWNTO Down timeout BOOL 0
LOCKD_O Locked output BOOL 0
U_CUR_T Up current time (in seconds) REAL 0.0
D_CUR_T Down current time (in seconds) REAL 0.0
12-27SIMATIC PCS 7 OSx 4.1.2 Library Presses
12.8 PUD (User-defined Press)
For a general discussion of user-defined devices, see Section 7.4.
The PUD device has two positions (up and down) and is controlled by twodiscrete signals with two discrete feedback signals.
The PUD is essentially the shell of a PDD device. The code which definesthe PDD has been reduced to a minimum, and input/output elements havebeen provided to allow you to create your own customized press andtranslate it for OSx.
The PUD has two alarm timers. When the URESET (DRESET) inputtransitions from false to true, the alarm timer U_CUR_T (D_CUR_T) starts.When the timer times out, the UPTO (DOWNTO) output becomes true, andremains true until the URESET (DRESET) input becomes false.
When you use a PUD device (FB359), the following function blocks must bepresent in the Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
12-28 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PUD (continued)
The PUD function block is shown in Figure 12-7, and its inputs and outputsare described in Table 12-15 and Table 12-16.
OB351
BO EN
press_8
PUD
ENO BO1
User Defined
R SAMPLE_T
BO ULS
BO DLS
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
R U_ALRM_T
R D_ALRM_T
BO LOCKD
CMMD BO
UPA BO
UPC BO
DOWNC BO
TRVL BO
FTR BO
0
0
0
0
0
0
0
0
0
1.0
0
0
0.1
FTL BO
0
FAILD BO
UPTO BO
DOWNTO BO
BO RHIGH
BO RLOW
0
0
0
BO RTOA
0
BO MRAISE
0
1.0
BO OVRDU
0 BO OVRDD
BO RTO
BO RTOB
BO URESET
BO DRESET
UPB BO
BO RESET
0
U_CUR_T R
LOCKD_O BO
UP BO
DOWN BO
D_CUR_T R
Figure 12-7 PUD Block
The PUD Block
12-29SIMATIC PCS 7 OSx 4.1.2 Library Presses
Table 12-15 Input Table for PUD
Element Description Type InitialValue
EN Enable BOOL 1
ULS Up feedback BOOL 0
DLS Down feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RTO Request to raise press BOOL 0
RTOA Request to raise option A, H BOOL 0
RTOB Request to raise option B, L BOOL 0
RHIGH Request to raise high BOOL 0
RLOW Request to raise low BOOL 0
RTC Request to lower press BOOL 0
RESET Clear feedback overrides BOOL 0
MRAISE Manual raise BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
U_ALRM_T Up alarm time (in seconds) REAL 1.0
D_ALRM_T Down alarm time (in seconds) REAL 1.0
OVRDU Override up feedback BOOL 0
OVRDD Override down feedback BOOL 0
URESET Up alarm timer reset BOOL 0
DRESET Down alarm timer reset BOOL 0
12-30 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PUD (continued)
Table 12-16 Output Table for PUD
Element Description Type InitialValue
ENO Output valid BOOL 0
CMMD Raise/lower command BOOL 0
UPC Raise command BOOL 0
DOWNC Lower command BOOL 0
UP Up BOOL 0
UPA Raise command option A BOOL 0
UPB Raise command option B BOOL 0
DOWN Down BOOL 0
TRVL Traveling BOOL 0
FTR Fail to raise BOOL 0
FTL Fail to lower BOOL 0
FAILD Failed BOOL 0
UPTO Up timeout BOOL 0
DOWNTO Down timeout BOOL 0
LOCKD_O Locked output BOOL 0
U_CUR_T Up current time (in seconds) REAL 0.0
D_CUR_T Down current time (in seconds) REAL 0.0
12-31SIMATIC PCS 7 OSx 4.1.2 Library Presses
12.9 PS1 (Three-Position Press/Type 1)
The PS1 device (FB360) is a three-position press (high, low, and down) andis controlled by two discrete signals with two discrete feedback signals.
The two discrete control signals consist of a low signal (SLOW) and a highsignal (SHIGH). The two signals cannot both be true at the same time.
• If the desired state of the press is up at high position (MRAISE=true andMHIGH=true), the SHIGH output is set to true (energized) to raise thepress at high position.
• If the desired state of the press is up at low position (MRAISE=true andMHIGH=false), the SLOW output is set to true (energized) to raise thepress at low position.
• If the desired state is down (MRAISE=false), the currently energizedsignal (SHIGH or SLOW) is set to false.
• The press, when receiving an up signal, starts raising and keepsraising until the currently energized signal becomes false.
• The RESET input clears the OVRD input and resets the alarm timer.The alarm timer (U_CUR_T or D_CUR_T) starts counting down when theRESET input goes false. If the HIO or LIO feedback does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDH and OVRDL inputs.
The two feedback signals consist of a raise-low feedback signal (LIO) and anraise-high feedback signal (HIO).
• The LIO input is expected to be true when the press is up at the lowposition; otherwise, it should be false.
• The HIO input is expected to be true when the press is up at the highposition; otherwise, it should be false.
• If you set SAME_FBK to true, only the LIO feedback will be active. Anyfeedback connections must then be made to the LIO input.
Overview
12-32 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PS1 (continued)
In manual mode, the outputs SLOW/SHIGH are set to the appropriate statebased on the status of the MHIGH and the MRAISE inputs, which youmanipulate from an operator station or from the program.
In auto mode, the RLOW, RHIGH, and RTC inputs set the state of theseoutputs, as follows:
RLOW sets MRAISE=1 and MHIGH=0
RHIGH sets MRAISE=1 and MHIGH=1
RTC sets MRAISE=0 and leaves MHIGH in its last state
In this mode, the MHIGH and MRAISE elements are set to reflect the lastrequested state. This is done to provide for a bumpless transfer if the devicechanges modes.
When you use a PS1 device, the following function blocks must be present inthe Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
12-33SIMATIC PCS 7 OSx 4.1.2 Library Presses
The PS1 function block is shown in Figure 12-8, and its inputs and outputsare described in Table 12-17 and Table 12-18.
OB351
BO EN
press_9
PS1
ENO BO1
Three-Positi
R SAMPLE_T
BO LIO
BO HIO
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
R U_ALRM_T
R D_ALRM_T
BO LOCKD
SLOW BO
SHIGH BO
DOWN BO
TRVL BO
FTRL BO
0
0
0
0
0
0
0
1.0
0
1.0
0
0.1
FTRH BO
BO RHIGH
0
0
0
BO MHIGH
0
0
BO OVRDL
0
BO OVRDH
BO RLOW
UP BO
BO SAME_FBK
0
UPH BO
UPL BO
UPTO BO
DOWNTO BO
FTR BO
FTL BO
FAILD BO
BO RESET
BO MRAISE
U_CUR_T R
LOCKD_O BO
BO IGN_OVRD
0
D_CUR_T R
Figure 12-8 PS1 Block
The PS1 Block
12-34 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PS1 (continued)
Table 12-17 Input Table for PS1
Element Description Type InitialValue
EN Enable BOOL 1
HIO High feedback BOOL 0
LIO Low feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RHIGH Request to raise high BOOL 0
RLOW Request to raise low BOOL 0
RTC Request to lower press BOOL 0
RESET Clear feedback overrides BOOL 0
MRAISE Manual raise/lower press BOOL 0
MHIGH Manual raise high BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
U_ALRM_T Up alarm time (in seconds) REAL 1.0
D_ALRM_T Down alarm time (in seconds) REAL 1.0
OVRDH Override high feedback BOOL 0
OVRDL Override low feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
SAME_FBK Same feedback (LIO=HIO) BOOL 0
12-35SIMATIC PCS 7 OSx 4.1.2 Library Presses
Table 12-18 Output Table for PS1
Element Description Type InitialValue
ENO Output valid BOOL 0
SHIGH Raise high command BOOL 0
SLOW Raise low command BOOL 0
UP Up BOOL 0
UPH Up high BOOL 0
UPL Up low BOOL 0
DOWN Down BOOL 0
TRVL Traveling BOOL 0
FTR Fail to raise BOOL 0
FTRH Fail to raise high BOOL 0
FTRL Fail to raise low BOOL 0
FTL Fail to lower BOOL 0
FAILD Failed BOOL 0
UPTO Up timeout BOOL 0
DOWNTO Down timeout BOOL 0
LOCKD_O Locked output BOOL 0
U_CUR_T Up current time (in seconds) REAL 0.0
D_CUR_T Down current time (in seconds) REAL 0.0
12-36 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
12.10 PS2 (Three-Position Press/Type 2)
The PS2 device (FB361) is a three-position press (high, low, and down) andis controlled by two discrete signals with two discrete feedback signals.
The two discrete control signals consist of a raise/lower signal (DRV) and aposition signal (POS) that determines whether the press raises at high orlow position.
• If the desired state of the press is raise high (MRAISE=true andMHIGH=true), the DRV and POS outputs are both set to true.
• If the desired state is raise low (MRAISE=true and MHIGH=false), theDRV output is set to true and the POS output is set to false.
• If the desired state is down (MRAISE=false), the DRV output is set tofalse to lower the press.
• The press, when receiving a raise signal, starts raising and keepsraising until DRV becomes false.
• The RESET input clears the OVRD input and resets the alarm timer.The alarm timer (U_CUR_T or D_CUR_T) starts counting down when theRESET input goes false. If the HIO or LIO feedback does not reflect thecorrect state, the TRVL output becomes true.
• If the IGN_OVRD feedback is set to true, the function block ignores theOVRDH and OVRDL inputs.
The two feedback signals consist of a raise-low feedback signal (LIO) and araise-high feedback signal (HIO).
• The LIO input is expected to be true when the press is up at lowposition; otherwise, it should be false.
• The HIO input is expected to be true when the press is up at highposition; otherwise it should be false.
• If you set SAME_FBK to true, only the LIO feedback will be active. Anyfeedback connections must then be made to the LIO input.
Overview
12-37SIMATIC PCS 7 OSx 4.1.2 Library Presses
In manual mode, the outputs DRV and POS are set to the appropriate statebased on the status of the MHIGH and the MRAISE inputs, which youmanipulate from an operator station or from the program.
In auto mode, the RLOW, RHIGH, and RTC inputs set the state of theseoutputs, as follows:
RLOW sets MRAISE=1 and MHIGH=0
RHIGH sets MRAISE=1 and MHIGH=1
RTC sets MRAISE=0 and leaves MHIGH in its last state
In this mode, the MHIGH and MRAISE elements are set to reflect the lastrequested state. This is done to provide for a bumpless transfer if the devicechanges modes.
When you use a PS2 device, the following function blocks must be present inthe Blocks folder of your S7 program:
• PACKSTAT (FC930)
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Required Blocks
12-38 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PS2 (continued)
The PS2 function block is shown in Figure 12-9, and its inputs and outputsare described in Table 12-19 and Table 12-20.
OB351
BO EN
press_10
PS2
ENO BO1
Three-Positi
R SAMPLE_T
BO HIO
BO LIO
BO DSBLD
BO NRDY
BO RTL
BO RTU
BO RTC
R U_ALRM_T
R D_ALRM_T
BO LOCKD
DRV BO
POS BO
DOWN BO
TRVL BO
FTRL BO
0
0
0
0
0
0
0
1.0
0
1.0
0
0.1
FTRH BO
BO RLOW
0
0
0
BO MRAISE
0
0 BO OVRDH
0
BO OVRDL
BO RHIGH
UP BO
BO SAME_FBK
0
UPH BO
U_CUR_T R
LOCKD_O BO
FTR BO
FTL BO
FAILD BO
BO RESET
BO MHIGH
UPTO BO
DOWNTO BO
UPL BO
0
BO IGN_OVRD
D_CUR_T R
Figure 12-9 PS2 Block
The PS2 Block
12-39SIMATIC PCS 7 OSx 4.1.2 Library Presses
Table 12-19 Input Table for PS2
Element Description Type InitialValue
EN Enable BOOL 1
HIO High feedback BOOL 0
LIO Low feedback BOOL 0
RTL Request to lock (place in auto mode) BOOL 0
RTU Request to unlock (place in manual mode) BOOL 0
RHIGH Request to raise high BOOL 0
RLOW Request to raise low BOOL 0
RTC Request to lower press BOOL 0
RESET Clear feedback overrides BOOL 0
MRAISE Manual raise/lower press BOOL 0
MHIGH Manual raise high BOOL 0
DSBLD Forced to manual mode BOOL 0
LOCKD Locked (auto mode) BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
U_ALRM_T Up alarm time (in seconds) REAL 1.0
D_ALRM_T Down alarm time (in seconds) REAL 1.0
OVRDH Override high feedback BOOL 0
OVRDL Override low feedback BOOL 0
IGN_OVRD Ignore feedback override BOOL 0
SAME_FBK Same feedback (LIO=HIO) BOOL 0
12-40 SIMATIC PCS 7 OSx 4.1.2 LibraryPresses
PS2 (continued)
Table 12-20 Output Table for PS2
Element Description Type InitialValue
ENO Output valid BOOL 0
DRV Raise/lower command BOOL 0
POS Position: 1=high, 0=low BOOL 0
UP Up BOOL 0
UPH Up high BOOL 0
UPL Up low BOOL 0
DOWN Down BOOL 0
TRVL Traveling BOOL 0
FTR Fail to raise BOOL 0
FTRH Fail to raise high BOOL 0
FTRL Fail to raise low BOOL 0
FTL Fail to lower BOOL 0
FAILD Failed BOOL 0
UPTO Up timeout BOOL 0
DOWNTO Down timeout BOOL 0
LOCKD_O Locked output BOOL 0
U_CUR_T Up current time (in seconds) REAL 0.0
D_CUR_T Down current time (in seconds) REAL 0.0
13-1SIMATIC PCS 7 OSx 4.1.2 Library Counter and TImer
Chapter 13
Counter and Timer
13.1 CT_DECL (Counter Declaration) 13-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2 TI_DECL (Timer Declaration) 13-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.3 TMR (Stopwatch Timer) 13-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13-2 SIMATIC PCS 7 OSx 4.1.2 LibraryCounter and Timer
13.1 CT_DECL (Counter Declaration)
You can use the CT_DECL function block (FB340) inside an SFC step orCFB. The counter counts from 0 towards a preset value incrementally everytime the input Boolean goes from false to true. You assign the preset valueto the PRESET input on the function block.
A counter can be controlled with the INPUT and ENABL inputs from variableassignment statements in an SFC step or in a CFC object.
• To start the counter counting, the ENABL bit must be true.
• When the INPUT bit transitions from false to true, the current countercount (CURRENT) is incremented by one.
• When the CURRENT count equals the PRESET count, the COUT becomestrue.
• To reset the counter, set the ENABL bit to false. The COUT becomesfalse, and the CURRENT count resets to zero.
The L_RANGE limit for OSx is automatically set to a default of 0. You canchange this value in the Comment field of the Operator Control &Monitoring dialog box by entering L_RANGE=<n>, where n is the new valuefor that limit. L_RANGE is used in OSx to configure the low range; it has noeffect on the operation of the CT_DECL block. In OSx, the PRESET valuedefines the high range.
Configure engineering units for the count of the CT_DECL block in theComment field of the Operator Control and Monitoring window. Seepage 1-26.
Overview
13-3SIMATIC PCS 7 OSx 4.1.2 Library Counter and TImer
The CT_DECL function block is shown in Figure 13-1, and its inputs andoutputs are described in Table 13-1 and Table 13-2.
OB351
BO EN
ctr_1
CT_DECL
ENO BO1
Counter Declaration
CURRENT I
COUT BO0
0
BO ENABL
I PRESET0
BO INPUT
Figure 13-1 CT_DECL Block
Table 13-1 Input Table for CT_DECL
Element Description Type InitialValue
EN Enable BOOL 1
ENABL Enable BOOL 0
INPUT Increment counter on 0→1 edge BOOL 0
PRESET Counter preset INT 0
Table 13-2 Output Table for CT_DECL
Element Description Type InitialValue
ENO Output valid BOOL 0
COUT Counter full (CURRENT = PRESET) BOOL 0
CURRENT Counter current count INT 0
The CT_DECLBlock
13-4 SIMATIC PCS 7 OSx 4.1.2 LibraryCounter and Timer
13.2 TI_DECL (Timer Declaration)
The TI_DECL function block (FB341) allows you to set up a delay timeinside an SFC step or CFB. The timers count down to 0 from a preset value.You assign the preset value to the PRESET input on the function block.
If the PRESET is “unlinked” within the CFC chart, then a PRESET changefrom OSx will take effect on the next reset of the timer. If the PRESET is“linked” (its value is provided directly by the controller program), then aPRESET change from OSx is not applied.
You can control a timer with the RESET and ENABL extensions from Mathassignment statements in an SFC step or in a Math or interlock CFB.
• If ENABL and RESET are set to true (=1), the timer (CURRENT) countsdown by increments equal to the value of SAMPLE_T. If SAMPLE_T is setcorrectly for the current OB (for example, 0.1 seconds for OB35), thetimer will be accurate.
• When CURRENT reaches zero, TOUT becomes true.
• If RESET is false (=0), CURRENT is reset to the PRESET value and TOUTbecomes false.
• When request enable (RENA) is true, RESET and ENABL have no effect.If RENA becomes false, the timer returns to the proper state accordingto RESET and ENABL.
The TI_DECL parameter for H_RANGE should be initialized to themaximum permissible value of the PRESET. For example, for a timer withUNITS=’minutes’, H_RANGE=10.0 indicates that the maximum PRESET thatcan be entered from OSx is 10.0 minutes. The TI_DECL parameter forL_RANGE is typically left as 0.0. Both H_RANGE and L_RANGE are not usedwithin TI_DECL but are provided solely for purposes of OSx (and are usedfor input range checking and display purposes).
An OSx deadband is used to specify the change (in percent of span) in theinput value required for OSx to update the value in the database. Thedeadband is automatically set to a default of 1.0% (0.01). You can changethe deadband value in the Comment field of the Operator Control &Monitoring dialog box by entering CHANGE=<n>, where n is the newdeadband value between 0.0 and 1.0. Set this deadband value to filter outnoise in the input signal. This value is used only to provide a setting for theOSx system. The TI_DECL function block does not use this value for anycalculation.
Overview
13-5SIMATIC PCS 7 OSx 4.1.2 Library Counter and TImer
The OSx timer tag has a units attribute that you can use to indicate thetime base of the TI_DECL block, such as seconds, minutes, or hours. Youconfigure these units in the Comment field of the Operator Control andMonitoring window. See page 1-26.
When a timer PRESET or CURRENT is displayed in OSx, the TI_DECLfunction block should be configured to show these values in the appropriatetime base. For example, a timer with a time base of one minute would haveCURRENT=1.0 indicate that one minute remains.
You configure the time base of the TI_DECL function block by setting thevalue of SAMPLE_T based on the execution cycle of the TI_DECL block.
For example, if a TI_DECL function block is in OB35 running at its defaultsetting of 100ms, the block executes 10 times per second. To have a timertag with UNITS=seconds (meaning that the PRESET is specified inseconds), set SAMPLE_T equal to 0.1.
For a timer with UNITS=minutes (meaning that the PRESET is specified inminutes), compute SAMPLE_T based on how often the TI_DECL block iscalled in a one-minute period. For a timer in the 100ms OB35, 10 calls persecond times 60 seconds equals 600 calls, so the SAMPLE_T value needs to be1.0 / 600 = 0.0016667 minutes (the amount CURRENT is decremented eachtime the block executes).
Similarly, for a timer with UNITS=hours, SAMPLE_T would be 0.0016667 /60 = 0.0000278 for a TI_DECL called every 100ms (10 calls per second times60 seconds times 60 minutes). Table 13-3 shows how different values for theunit attribute affect SAMPLE_T for different execution times.
Table 13-3 Calculating SAMPLE_T
Execution Time Units (Time Base) SAMPLE_T
seconds 0.1
100ms (OB35) minutes 0.0016667
hours 0.0000278
seconds 1
1000ms (OB32) minutes 0.0166667
hours 0.0002778
13-6 SIMATIC PCS 7 OSx 4.1.2 LibraryCounter and Timer
TI_DECL (continued)
The TI_DECL function block is shown in Figure 13-2, and its inputs andoutputs are described in Table 13-4 and Table 13-5.
OB351
BO EN
tmr_1
TI_DECL
ENO BO1
Timer Declaration
R SAMPLE_T
CURRENT R
TOUT BO
0.0
0.1
1.0
100.0
0
R PRESET
BO ENABL0
BO RESET
R H_RANGE
R L_RANGE
BO RENA0
Figure 13-2 TI_DECL Block
The TI_DECL Block
13-7SIMATIC PCS 7 OSx 4.1.2 Library Counter and TImer
Table 13-4 Input Table for TI_DECL
Element Description Type InitialValue
EN Enable BOOL 1
H_RANGE OSx high range attribute REAL 100.0
L_RANGE OSx low range attribute REAL 0.0
SAMPLE_T Sample time (in seconds) REAL 0.1
PRESET Timer preset time (in seconds) REAL 1.0
ENABL Enable timer BOOL 0
RESET Reset timer (0 = reset) BOOL 0
RENA Request enable BOOL 0
Table 13-5 Output Table for TI_DECL
Element Description Type InitialValue
ENO Output valid BOOL 0
TOUT Timer expired (CURRENT = 0) BOOL 0
CURRENT Current time (in seconds) REAL 0.0
13-8 SIMATIC PCS 7 OSx 4.1.2 LibraryCounter and Timer
13.3 TMR (Stopwatch Timer)
The TMR function block (FB429) is a three-state device (running, stopped,and hold).
Five I/O elements allow you to manipulate the timer device from an SFCstep or CFC object.
• The RSTRT input starts the timer by setting the current value CUR to 0and the RUNNG output to 1.
Each time the tick-rate value elapses, the CUR value is increased by 1.
• The RSTOP input stops the timer by setting the RUNNG output to 0.The TOUT output also becomes 0. The RSTOP input has no effect on thecurrent value.
• The RHOLD input sets the HOLD output to 1 to stop the timertemporarily. This command freezes the current value and the currenttick-rate position. The HOLD output is automatically set to 1 if there isa controller power failure, and the TMR block is called by a restart OB.
• The RCONT input sets the HOLD output to 0 and continues timing fromthe point at which it was frozen by the RHOLD input.
• The RESET input sets the CUR value to 0. If the timer is frozen with aRHOLD input, the RESET input unfreezes it by setting the HOLD outputto 0.
The CUR value is a read/write integer; CUR_O contains a copy of CUR andcan be connected to other blocks. The PSET value is an integer variable thatcontains the preset value of the timer.
NOTE: If you write to the current value CUR while the timer is running, thetimer continues to count from the new current value.
Some timer inputs take precedence over the other input commands:
• RESET works at any time.
• RSTOP takes precedence over RSTRT, RHOLD, and RCONT.
• RCONT and RESET take precedence over RHOLD.
Using the DeviceTimer
13-9SIMATIC PCS 7 OSx 4.1.2 Library Counter and TImer
The OSx timer tag has a units attribute that you can use to indicate thetime base of the TMR block, such as seconds, minutes, or hours. Youconfigure these units in the Comment field of the Operator Control andMonitoring window. See page 1-26.
When a timer PSET or CUR is displayed in OSx, the TMR function blockshould be configured to show these values in the appropriate time base. Forexample, for a timer with a time base of one minute, CUR=1.0 indicates thatone minute remains.
You configure the time base of the TMR function block by setting the valueof SAMPLE_T based on the execution cycle of the TMR block.
For example, if a TMR function block is in OB35 running at its defaultsetting of 100ms, the block executes 10 times per second. To have a timertag with UNITS=seconds (meaning that the PSET is specified in seconds),set SAMPLE_T equal to 0.1.
For a timer with UNITS=minutes (meaning that the PSET is specified inminutes), compute SAMPLE_T based on how often the TMR block is called ina one-minute period. For a timer in the 100ms OB35, 10 calls per secondtimes 60 seconds equals 600 calls, so the SAMPLE_T value needs to be 1.0 /600 = 0.0016667 minutes (the amount CUR is decremented each time theblock executes).
Similarly, for a timer with UNITS=hours, SAMPLE_T would be 0.0016667 /60 = 0.0000278 for a TMR called every 100ms (10 calls per second times 60seconds times 60 minutes). Table 13-6 shows how different values for theunit attribute affect SAMPLE_T for different execution times.
Table 13-6 Calculating SAMPLE_T
Execution Time Units (Time Base) SAMPLE_T
seconds 0.1
100ms (OB35) minutes 0.0016667
hours 0.0000278
seconds 1
1000ms (OB32) minutes 0.0166667
hours 0.0002778
13-10 SIMATIC PCS 7 OSx 4.1.2 LibraryCounter and Timer
TMR (Stopwatch Timer) (continued)
When you use a TMR block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
The TMR function block is shown in Figure 13-3, and its inputs and outputsare described in Table 13-7 and Table 13-8.
OB351
BO EN
Tmr5
TMR
ENO BO1
Stopwatch Time
BO RHOLD
TOUT BO
MAXC BO
0
0
0
0
0
BO RCONT
BO RESET0
BO RUNNG
BO RSTRT
BO RSTOP
BO HOLD0
GT BO
CUR_O I
EQ BO
0.1
32767
R SAMPLE_T
R RATE1.0
I PSET
I CUR0
Figure 13-3 TMR Block
Required Blocks
The TMR Block
13-11SIMATIC PCS 7 OSx 4.1.2 Library Counter and TImer
Table 13-7 Input Table for TMR
Element Description Type InitialValue
EN Enable BOOL 1
RSTRT Start timer BOOL 0
RSTOP Stop timer BOOL 0
RHOLD Hold current time BOOL 0
RCONT Continue counting BOOL .0
RESET Reset timer (CUR = 0) BOOL 0
RUNNG Timer running BOOL 0
HOLD Timer in hold BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
RATE Tick rate of timer REAL 1.0
PSET Timer preset INT 32767
CUR Current timer count INT 0
Table 13-8 Output Table for TMR
Element Description Type InitialValue
ENO Output valid BOOL 0
MAXC Maximum value (32767) reached BOOL 0
TOUT Time out (CUR >= PSET) BOOL 0
GT CUR > PSET BOOL 0
EQ True when CUR = PSET BOOL 0
CUR_O Current timer count output INT 0
13-12 SIMATIC PCS 7 OSx 4.1.2 LibraryCounter and Timer
14-1SIMATIC PCS 7 OSx 4.1.2 Library Basic Math Operations
Chapter 14
Basic Math Operations
14.1 Overview 14-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.2 ABS_MTH (Absolute Value) 14-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.3 DIV_MTH (Divider) 14-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.4 MLT_MTH (Multiplier) 14-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.5 SQR_MTH (Square) 14-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.6 SQRT_MTH (Square Root) 14-7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.7 SUB_MTH (Subtractor) 14-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14.8 SUM_MTH (Summer) 14-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14-2 SIMATIC PCS 7 OSx 4.1.2 LibraryBasic Math Operations
14.1 Overview
This chapter describes the functions that are provided in the OSx Library toperform the basic math operations of adding, subtracting, multiplying,dividing, squaring, finding the square root, and returning the absolutevalue of inputs.
These basic math functions are included in the OSx Library forcompleteness in replicating APT functionality. If you prefer, you can useStructured Control Language (SCL) to perform the same functions. Refer tothe SIMATIC Software Structured Control Language (SCL) forS7-300/S7-400 Programming Manual (Order No. 6ES7811--1BA00--8BA0)for detailed information.
14-3SIMATIC PCS 7 OSx 4.1.2 Library Basic Math Operations
14.2 ABS_MTH (Absolute Value)
The ABS_MTH function (FC900) returns the absolute value of a real input.For example, if you input the value IN=--3.2, ABS_MTH returns a RET_VALof 3.2.
The ABS_MTH function is shown in Figure 14-1, and its inputs and outputsare described in Table 14-1 and Table 14-2.
1
0.0
abs_23
ABS_MTHAbsolute Value OB35
1
ENO BOBO EN
R IN RET_VAL R
Figure 14-1 ABS_MTH Block
Table 14-1 Input Table for ABS_MTH
Element Description Type InitialValue
EN Enable BOOL 1
IN Input value REAL 0.0
Table 14-2 Output Table for ABS_MTH
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Absolute value of input REAL 0.0
14-4 SIMATIC PCS 7 OSx 4.1.2 LibraryBasic Math Operations
14.3 DIV_MTH (Divider)
The DIV_MTH function (FC901) divides the DIVIDEND by the DIVISOR andreturns the quotient. For example, if DIVIDEND is 6.0 and DIVISOR is 1.5,DIV_MTH returns a quotient RET_VAL of 4.0. If a division error occurs, suchas dividing by zero, ENO is set to false (0).
The DIV_MTH function is shown in Figure 14-2, and its inputs and outputsare described in Table 14-3 and Table 14-4.
1
0.0
div_3
DIV_MTHDivider Math OB1
1
ENO BOBO EN
R DIVIDEND RET_VAL R
0.0 R DIVISOR
Figure 14-2 DIV_MTH Block
Table 14-3 Input Table for DIV_MTH
Element Description Type InitialValue
EN Enable BOOL 1
DIVIDEND Dividend REAL 0.0
DIVISOR Divisor REAL 0.0
Table 14-4 Output Table for DIV_MTH
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Quotient of inputs REAL 0.0
14-5SIMATIC PCS 7 OSx 4.1.2 Library Basic Math Operations
14.4 MLT_MTH (Multiplier)
The MLT_MTH function (FC902) multiplies two inputs and returns theproduct. For example, if IN1=6.0 and IN2=3.0, MLT_MTH returns a RET_VALof 18.0. When RET_VAL goes to infinity, ENO is set to 0.
The MLT_MTH function is shown in Figure 14-3, and its inputs and outputsare described in Table 14-5 and Table 14-6.
1
0.0
mult_5
MLT_MTHMultiplier Math OB1
1
ENO BOBO EN
R IN1 RET_VAL R
0.0 R IN2
Figure 14-3 MLT_MTH Block
Table 14-5 Input Table for MLT_MTH
Element Description Type InitialValue
EN Enable BOOL 1
IN1 Multiplicand REAL 0.0
IN2 Multiplier REAL 0.0
Table 14-6 Output Table for MLT_MTH
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Product of inputs REAL 0.0
14-6 SIMATIC PCS 7 OSx 4.1.2 LibraryBasic Math Operations
14.5 SQR_MTH (Square)
The SQR_MTH function (FC904) returns the square of a real input. Forexample, if you input the value IN=3.0, SQR_MTH returns a RET_VAL of 9.0.
The SQR_MTH function is shown in Figure 14-4, and its inputs and outputsare described in Table 14-7 and Table 14-8.
1
0.0
square_9
SQR_MTHSquare Math OB1
1
ENO BOBO EN
R IN RET_VAL R
Figure 14-4 SQR_MTH Block
Table 14-7 Input Table for SQR_MTH
Element Description Type InitialValue
EN Enable BOOL 1
IN Input value REAL 0.0
Table 14-8 Output Table for SQR_MTH
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Square of input REAL 0.0
14-7SIMATIC PCS 7 OSx 4.1.2 Library Basic Math Operations
14.6 SQRT_MTH (Square Root)
The SQRT_MTH function (FC905) returns the square root of a real input.For example, if you input the value IN=16.0, SQRT_MTH returns a RET_VALof 4.0.
The input IN must be a positive real number; otherwise, the output RET_VALis invalid. If the input is a negative number, RET_VAL is set to 0.0, and ENOis set to false (0).
The SQRT_MTH function is shown in Figure 14-5, and its inputs andoutputs are described in Table 14-9 and Table 14-10.
1
0.0
sqroot_4
SQRT_MTHSquare Root OB1
1
ENO BOBO EN
R IN RET_VAL R
Figure 14-5 SQRT_MTH Block
Table 14-9 Input Table for SQRT_MTH
Element Description Type InitialValue
EN Enable BOOL 1
IN Input value REAL 0.0
Table 14-10 Output Table for SQRT_MTH
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Square root of input REAL 0.0
14-8 SIMATIC PCS 7 OSx 4.1.2 LibraryBasic Math Operations
14.7 SUB_MTH (Subtractor)
The SUB_MTH function (FC906) subtracts the second input from the firstinput and returns the difference. For example, if IN1=7.7 and IN2=3.0,SUB_MTH returns a RET_VAL of 4.7.
The SUB_MTH function is shown in Figure 14-6, and its inputs and outputsare described in Table 14-11 and Table 14-12.
1
0.0
sub_18
SUB_MTHSubtract Math OB35
1
ENO BOBO EN
R IN1 RET_VAL
0.0 R IN2
Figure 14-6 SUB_MTH Block
Table 14-11 Input Table for SUB_MTH
Element Description Type InitialValue
EN Enable BOOL 1
IN1 Minuend REAL 0.0
IN2 Subtrahend REAL 0.0
Table 14-12 Output Table for SUB_MTH
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Difference of inputs REAL 0.0
14-9SIMATIC PCS 7 OSx 4.1.2 Library Basic Math Operations
14.8 SUM_MTH (Summer)
The SUM_MTH function (FC907) adds two inputs and returns the sum. Forexample, if IN1=7.7 and IN2=3.0, SUM_MTH returns a RET_VAL of 10.7.
The SUM_MTH function is shown in Figure 14-7, and its inputs andoutputs are described in Table 14-13 and Table 14-14.
1
0.0
add_1
SUM_MTHSum Math OB35
1
ENO BOBO EN
R IN1 RET_VAL R
0.0 R IN2
Figure 14-7 SUM_MTH Block
Table 14-13 Input Table for SUM_MTH
Element Description Type InitialValue
EN Enable BOOL 1
IN1 First addend REAL 0.0
IN2 Second addend REAL 0.0
Table 14-14 Output Table for SUM_MTH
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Sum of inputs REAL 0.0
14-10 SIMATIC PCS 7 OSx 4.1.2 LibraryBasic Math Operations
15-1SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
Chapter 15
Math Functions
15.1 BCDBIN (BCD-to-Binary Conversion) 15-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2 BINBCD (Binary-to-BCD Conversion) 15-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.3 BIT_ASGN (Bit Assign) 15-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.4 BITCLEAR (Bit Clear) 15-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.5 BITSET (Bit Set) 15-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.6 BITTEST (Bit Test) 15-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.7 EDGE (Edge) 15-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.8 FRAC (Fraction) 15-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.9 LEAD_LAG (Lead Lag) 15-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.10 LEFT_SH (Left Shift) 15-19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.11 LIMIT (Limit) 15-21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.12 MAX (Maximum Value) 15-23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.13 MIN (Minimum Value) 15-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.14 MINMAX (Minimum and Maximum Value) 15-27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.15 RIGHT_SH (Right Shift) 15-29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.16 ROUND (Round) 15-31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.17 SCL_BLK (Scale) 15-33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.18 TRUNC (Truncate) 15-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-2 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
15.1 BCDBIN (BCD-to-Binary Conversion)
The BCDBIN function block (FB409) converts a four-digit BCD(binary-coded decimal) value in the range 0000 to 9999 to an integer. Noticethat the BCD input value is in hex format, and the digits range from 0 to 9(no A to F).
If you choose to write your program in SCL, the syntax for this function isas follows:
OUT := BCDBIN(IN := word_1);
Figure 15-1 shows how the BCDBIN function block works.
0 0 00 0 1 0 0 1 0 0 110 0 0
0 0 9 9BCDvalue
Decimal equivalent ofBCD value when IN = 153.
0 0 00 0 0 1 1 0 0 1 100 0 0
Decimal equivalent ofinteger value when OUT = 99.
IN:binary value
OUT:binary value
Figure 15-1 BCDBIN Example
Overview
15-3SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
The BCDBIN function block is shown in Figure 15-2, and its inputs andoutputs are described in Table 15-1 and Table 15-2.
1
0
bcdbin_2
BCDBINBCD to Binary OB35
1
ENO BO
OUT I
BO EN
W IN
Figure 15-2 BCDBIN Block
Table 15-1 Input Table for BCDBIN
Element Description Type InitialValue
EN Enable BOOL 1
IN BCD input value (0000--9999) WORD 16#0
Table 15-2 Output Table for BCDBIN
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Integer output INT 0
The BCDBIN Block
15-4 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
15.2 BINBCD (Binary-to-BCD Conversion)
The BINBCD function block (FB410) converts a binary integer value in therange 0 to 9999 to a BCD (binary-coded decimal) value.
If you choose to write your program in SCL, the syntax for this function isas follows:
OUT := BINBCD(IN := int_1);
Figure 15-3 shows how the BINBCD function block works.
0 0 4 3BCDvalue
0 0 00 0 0 1 0 0 0 1 100 0 0
Decimal equivalent ofBCD value when OUT = 67.
0 0 00 0 0 0 1 1 0 1 100 0 0
Decimal equivalent ofinteger value when IN = 43.
OUT:binary value
IN:binary value
Figure 15-3 BINBCD Example
Overview
15-5SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
The BINBCD function block is shown in Figure 15-4, and its inputs andoutputs are described in Table 15-3 and Table 15-4.
1
0
binbcd_2
BINBCDBinary to BCD OB35
1
ENO BO
OUT W
BO EN
I IN
Figure 15-4 BINBCD Block
Table 15-3 Input Table for BINBCD
Element Description Type InitialValue
EN Enable BOOL 1
IN Integer input INT 0
Table 15-4 Output Table for BINBCD
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT BCD output WORD 16#0
The BINBCD Block
15-6 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
15.3 BIT_ASGN (Bit Assign)
The BIT_ASGN function (FC912) sets an individual bit position of an inputword to true (1) or false (0) based on the result of a Boolean expression.
If you choose to write your program in SCL, the syntax for this function isas follows:
RET_VAL := BIT_ASGN(IN_WORD := word_1, BOOL_EXP := bool_1,BIT_NUM := int_1);
Figure 15-5 shows how the BIT_ASGN function works. Note that the mostsignificant bit is labeled 1, while the least significant bit is labeled 16. If youenter 13 in BIT_NUM, you are specifying the thirteenth bit from the left ormost significant bit.
1 2 3 4 5 6 7 8 9 10 11 13 14 15 1612
0 1 0 0 0 0 1 110 0 0 0 0 00
Most significant bit
Binary equivalent of IN_WORD
Least significant bit
BIT_NUM=13 sets bit 13 to thevalue of the Boolean expression
Figure 15-5 BIT_ASGN Example
Overview
15-7SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
The BIT_ASGN function is shown in Figure 15-6, and its inputs and outputsare described in Table 15-5 and Table 15-6.
1
0
0
16#0
bitasn_4
BIT_ASGNBit Assign OB35
1
ENO BOBO EN
W IN_WORD
I BIT_NUM
BO BOOL_EXP
RET_VAL W
Figure 15-6 BIT_ASGN Function
Table 15-5 Input Table for BIT_ASGN
Element Description Type InitialValue
EN Enable BOOL 1
BIT_NUM Number of the bit to be set INT 0
BOOL_EXP Value to assign the bit BOOL 0
IN_WORD Word containing a bit to be set WORD 16#0
Table 15-6 Output Table for BIT_ASGN
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Output word with assigned bit position WORD 16#0
The BIT_ASGNFunction
15-8 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
15.4 BITCLEAR (Bit Clear)
The BITCLEAR function (FC913) sets a specified bit in an input word tofalse or off (0).
If you choose to write your program in SCL, the syntax for this function isas follows:
RET_VAL := BITCLEAR(IN_WORD := word_1, BIT_NUM := int_1);
Figure 15-7 shows an example of BITCLEAR. Note that the most significantbit is labeled 1, while the least significant bit is labeled 16. If you enter 9 inBIT_NUM, you are specifying the ninth bit from the left or most significantbit.
1 2 3 4 5 6 7 8 9 10 11 13 14 15 1612
0 1 0 0 0 0 1 110 0 0 0 0 00
Most significant bit
Binary equivalent of IN_WORD
Least significant bit
Reset bit 9 to 0
Figure 15-7 BITCLEAR Example
Overview
15-9SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
The BITCLEAR function is shown in Figure 15-8, and its inputs andoutputs are described in Table 15-7 and Table 15-8.
1
0
16#0
bitclr_3
BITCLEARBit Clear OB35
1
ENO BOBO EN
W IN_WORD
I BIT_NUM RET_VAL W
Figure 15-8 BITCLEAR Function
Table 15-7 Input Table for BITCLEAR
Element Description Type InitialValue
EN Enable BOOL 1
BIT_NUM Number of the bit to be cleared (set to false or 0) INT 0
IN_WORD Word containing a bit to be cleared WORD 16#0
Table 15-8 Output Table for BITCLEAR
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Output word with bit cleared WORD 16#0
The BITCLEARFunction
15-10 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
15.5 BITSET (Bit Set)
The BITSET function (FC914) sets a specified bit in an input word to true oron (1).
If you choose to write your program in SCL, the syntax for this function isas follows:
RET_VAL := BITSET(IN_WORD := word_1, BIT_NUM := int_1);
Figure 15-9 shows an example of BITSET. Note that the most significant bitis labeled 1, while the least significant bit is labeled 16. If you enter 13 inBIT_NUM, you are specifying the thirteenth bit from the left or mostsignificant bit.
1 2 3 4 5 6 7 8 9 10 11 13 14 15 1612
0 1 0 0 0 0 1 110 0 0 0 0 00
Most significant bit
Binary equivalent of IN_WORD
Least significant bit
Set bit 13 to 1
Figure 15-9 BITSET Example
Overview
15-11SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
The BITSET function is shown in Figure 15-10, and its inputs and outputsare described in Table 15-9 and Table 15-10.
1
0
16#0
bitset_1
BITSETSet Bit OB35
1
ENO BOBO EN
W IN_WORD
I BIT_NUM RET_VAL W
Figure 15-10 BITSET Function
Table 15-9 Input Table for BITSET
Element Description Type InitialValue
EN Enable BOOL 1
BIT_NUM Number of the bit to be set to true (1) INT 0
IN_WORD Word containing a bit to be set WORD 16#0
Table 15-10 Output Table for BITSET
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Output word with bit set WORD 16#0
The BITSETFunction
15-12 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
15.6 BITTEST (Bit Test)
The BITTEST function (FC916) checks the status of a specified bit.
If you choose to write your program in SCL, the syntax for this function isas follows:
RET_VAL := BITTEST(IN_WORD := word_1, BIT_NUM := int_1);
Figure 15-11 shows an example of BITTEST. Note that the most significantbit is labeled 1, while the least significant bit is labeled 16. If you enter 12in BIT_NUM, you are specifying the twelfth bit from the left or mostsignificant bit.
0 1 0 0 0 0 1 110 0 0 0 0 00
Most significant bit
Binary equivalent of IN_WORD
Least significant bit
Bit 12 = TRUE
1 2 3 4 5 6 7 8 9 10 11 13 14 15 1612
Figure 15-11 BITTEST Example
Overview
15-13SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
The BITTEST function is shown in Figure 15-12, and its inputs and outputsare described in Table 15-11 and Table 15-12.
1
16#0
0
bittst_7
BITTESTBit Test OB35
1
ENO BO
RET_VAL BO
BO EN
W IN_WORD
I BIT_NUM
Figure 15-12 BITTEST Function
Table 15-11 Input Table for BITTEST
Element Description Type InitialValue
EN Enable BOOL 1
BIT_NUM Number of the bit to be tested INT 0
IN_WORD Word containing a bit to be tested WORD 16#0
Table 15-12 Output Table for BITTEST
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Result (1=true; 0=false) BOOL 0
The BITTESTFunction
15-14 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
15.7 EDGE (Edge)
The EDGE function block (FB388) detects a change from false to true in thevalue of a Boolean expression. When that expression changes from false totrue, the returned value of the function becomes true and remains true untilthe next call is made to the EDGE instance.
The EDGE function block is shown in Figure 15-13, and its inputs andoutputs are described in Table 15-13 and Table 15-14.
1
0
edge_5
EDGEEdge OB35
1
ENO BO
RVAL BO
BO EN
BO BOOL_EXP
Figure 15-13 EDGE Block
Table 15-13 Input Table for EDGE
Element Description Type InitialValue
EN Enable BOOL 1
BOOL_EXP Boolean expression to be watched for 0→1 change BOOL 0
Table 15-14 Output Table for EDGE
Element Description Type InitialValue
ENO Output valid BOOL 0
RVAL 1=edge found BOOL 0
15-15SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
15.8 FRAC (Fraction)
The FRAC function (FC917) returns the fractional portion of a real number.If the IN input is negative, the RET_VAL output is also negative.
For example, for the number IN=--11.467 the FRAC function returns theRET_VAL --0.467; for the IN expression 5.0/4.0 the FRAC function returns theRET_VAL 0.25.
If you choose to write your program in SCL, the syntax for this function isas follows:
RET_VAL := FRAC(IN := real_1);
The FRAC function is shown in Figure 15-14, and its inputs and outputs aredescribed in Table 15-15 and Table 15-16.
1
0.0
fract_2
FRACFraction OB35
1
ENO BO
RET_VAL R
BO EN
R IN
Figure 15-14 FRAC Function
Table 15-15 Input Table for FRAC
Element Description Type InitialValue
EN Enable BOOL 1
IN Real input REAL 0.0
Table 15-16 Output Table for FRAC
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Fractional portion of the input REAL 0.0
15-16 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
15.9 LEAD_LAG (Lead Lag)
The LEAD_LAG function block (FB389) allows signal processing to be doneon an analog variable. An output (OUT) is calculated based on an input (IN)and the specified gain (GAIN), lead (TLEAD), and lag (TLAG) values. The gainvalue must be greater than zero.
Typically, LEAD_LAG is used in conjunction with loops as a compensator indynamic feed-forward control. LEAD_LAG consists of two parts: phase leadshifts the phase of the function’s output so that it leads the input, whereasphase lag shifts the output so that it lags behind the input. Because the lagoperation is equivalent to an integration, it can be used as a noisesuppressor or a low-pass filter. A lead operation is equivalent to adifferentiation and is thus a high-pass filter. LEAD_LAG combined cancause the output phase to lag behind the input at low frequency, and to leadthe input at high frequency, and can thus be used as a band-pass filter.
The IN, TLEAD, TLAG, and GAIN inputs must be real values.
• IN is a real variable.
• TLEAD specifies a time in minutes that is associated with the responseimmediately after a change in the input.
• TLAG specifies the time in minutes required to reach 63.2 percent (thefirst standard deviation) of the final output after a change in the input.
• GAIN specifies the ratio of the change in output to the change in inputat a steady state, as shown in the following equation:
Gain =∆ output∆ input
Overview
15-17SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
The LEAD_LAG algorithm uses the following equation.
Yn= TLagTLag + Ts Yn−1+ Gain TLead + TsTLag + Ts
Xn− Gain TLeadTLag + Ts Xn−1
where Yn= present output, Yn−1= previous output,Xn= present input, Xn–1= previous input, andTs= sample time in minutes.
The output depends on the ratio of lead to lag as explained below. Assumethe following values in each example: ∆ input and gain = 1.0
If TLead / TLag is greater than 1.0, then the initial response overshoots thesteady-state output value.
Initial output= ∆input * Gain TLeadTLag = 1.0 * 1.0 2.0
1.0 = 2.0
2.0
n = 1 2 3
Yn
0
steady---state output = 1.0
4
If TLead / TLag is less than 1.0, then the initial response undershoots thesteady-state output value.
Initial output= ∆input * Gain TLeadTLag = 1.0 * 1.0 1.02.0 = 0.5
0.5
n = 1 2 3
Yn
0
steady---state output = 1.0
4
If TLead / TLag is equal to 1.0, then the initial response instantaneouslyreaches the steady-state output value.
Initial output= ∆input * Gain TLeadTLag = 1.0 * 1.0 1.0
1.0 = 1.0
n = 1 2 3
Yn
0
steady---state output = 1.0
4
15-18 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
LEAD_LAG (continued)
The LEAD_LAG function block is shown in Figure 15-15, and its inputs andoutputs are described in Table 15-17 and Table 15-18.
1
0.0
0.0
1.0
ldlg_13
LEAD_LAGLead Lag OB35
1
ENO BOBO EN
R SAMPLE_P
SAMPLE_C R
R TLEAD
1.0
1.0
R TLAG
R GAIN
OUT R
R IN
0.1 R SAMPLE_T
Figure 15-15 LEAD_LAG Block
Table 15-17 Input Table for LEAD_LAG
Element Description Type InitialValue
EN Enable BOOL 1
IN Input variable REAL 0.0
TLEAD Lead time (in minutes) REAL 1.0
TLAG Lag time (in minutes) REAL 1.0
GAIN Gain ratio REAL 1.0
SAMPLE_T Sample time (in seconds) REAL 0.1
SAMPLE_PRESET Time between iterations (in minutes) REAL 0.0
Table 15-18 Output Table for LEAD_LAG
Element Description Type InitialValue
ENO Output valid BOOL 0
SAMPLE_CURRENT Time until next iteration (in minutes) REAL 0.0
OUT Output value REAL 0.0
The LEAD_LAGBlock
15-19SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
15.10 LEFT_SH (Left Shift)
The LEFT_SH function (FC920) moves the bits of a word to the left (fromthe least significant bit towards the most significant bit) and fills thevacated slots on the right with zeroes. Values to the left of the shifted bitsare lost.
If you choose to write your program in SCL, the syntax for this function isas follows:
RET_VAL := LEFT_SH(IN_VAR := in_1, BIT_NUM := int_2);
Figure 15-16 shows an example of how the LEFT_SH function works.
0 1 0 0 0 0 110 0 0 0 0 00
Most significant bit
Binary equivalent of signed integer value(IN_VAR): 147
0 1 0 0 0 0 1 1 0 00 0 0 0 0
Signed integer value after binary value is shifted (RET_VAL): 1176
1
1
RET_VAL := LEFT_SH(IN_VAR := 147, BIT_NUM := 3);
Figure 15-16 LEFT_SH Example
Overview
15-20 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
LEFT_SH (continued)
The LEFT_SH function is shown in Figure 15-17, and its inputs and outputsare described in Table 15-19 and Table 15-20.
1
0
0
lshift_8
LEFT_SHLeft Shift OB35
1
ENO BO
RET_VAL W
BO EN
W IN_VAR
I BIT_NUM
Figure 15-17 LEFT_SH Function
Table 15-19 Input Table for LEFT_SH
Element Description Type InitialValue
EN Enable BOOL 1
IN_VAR Word to be shifted WORD 16#0
BIT_NUM Number of places to be shifted to the left. INT 0
Table 15-20 Output Table for LEFT_SH
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Word that results from shifting the bits WORD 16#0
The LEFT_SHBlock
15-21SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
15.11 LIMIT (Limit)
The LIMIT function (FC921) restricts the value of a variable. LIMITensures that the output is between the specified high and low limits.
The LIMIT function assigns a value to the output according to these rules:
• If the input IN is greater than or equal to the low limit LLIM and lessthan or equal to the high limit HLIM, the output OUT is assigned theinput value.
For example, if the low limit LLIM is --3.7 and the high limit HLIM is 8.0,and you input a value of 2.6, LIMIT returns the OUT value 2.6.
• If IN is greater than HLIM, OUT is assigned the HLIM value.
For example, if LLIM is --3.7 and HLIM is 8.0, and IN=11.2, LIMITreturns the value 8.0.
• If IN is less than LLIM, OUT is assigned the LLIM value.
For example, if LLIM is --3.7 and HLIM is 8.0, and IN=--4.5, LIMITreturns the value --3.7.
If you choose to write your program in SCL, the syntax for this function isas follows:
OUT := LIMIT(IN := real_1, HLIM := real_2,LLIM := real_3);
Overview
15-22 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
LIMIT (continued)
The LIMIT function is shown in Figure 15-18, and its inputs and outputsare described in Table 15-21 and Table 15-22.
1
0.0
0.0
0.0
lim_30
LIMITLimit OB35
1
ENO BO
OUT R
BO EN
R IN
R HLIM
R LLIM
Figure 15-18 LIMIT Function
Table 15-21 Input Table for LIMIT
Element Description Type InitialValue
EN Enable BOOL 1
HLIM High limit value REAL 0.0
LLIM Low limit value REAL 0.0
IN Input value REAL 0.0
Table 15-22 Output Table for LIMIT
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Result REAL 0.0
The LIMIT Block
15-23SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
15.12 MAX (Maximum Value)
The MAX function block (FB390) tracks the maximum value of a variableover time. When the MAX function block executes, the input value isassigned to the maximum value. When a new input exceeds the currentmaximum value, this new input is assigned to the maximum value.
If you choose to write your program in SCL, the syntax for this function isas follows:
MAX(IN := real_1, MAX := real_2);
Figure 15-19 shows an example of how the MAX function block works.
IN
1
MAX
2
1
0
3
1
2
2
2
3
Figure 15-19 MAX Example
Overview
15-24 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
MAX (continued)
The MAX function block is shown in Figure 15-20, and its inputs andoutputs are described in Table 15-23 and Table 15-24.
1
0.0
max_19
MAXMaximum Value OB35
1
ENO BOBO EN
R IN
0.0 R MAX
MAX_OUT R
Figure 15-20 MAX Block
Table 15-23 Input Table for MAX
Element Description Type InitialValue
EN Enable BOOL 1
IN Input value REAL 0.0
MAX Maximum value REAL 0.0
Table 15-24 Output Table for MAX
Element Description Type InitialValue
ENO Output valid BOOL 0
MAX_OUT Maximum value output REAL 0.0
The MAX Block
15-25SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
15.13 MIN (Minimum Value)
The MIN function block (FB391) tracks the minimum value of a variableover time. When the MIN function block executes, the input value isassigned to the minimum value. When a new input is less than the currentminimum value, this new input is assigned to the minimum value.
If you choose to write your program in SCL, the syntax for this function isas follows:
MIN(IN := real_1, MIN := real_2);
Figure 15-21 shows an example of how the MIN function block works.
IN
1
MIN
2
2
0
3
2
1
1
0
0
Figure 15-21 MIN Example
Overview
15-26 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
MIN (continued)
The MIN function block is shown in Figure 15-22, and its inputs andoutputs are described in Table 15-25 and Table 15-26.
1
0.0
min_24
MINMinimum Value OB35
1
ENO BOBO EN
R IN
0.0 R MIN
OUT_MIN R
Figure 15-22 MIN Block
Table 15-25 Input Table for MIN
Element Description Type InitialValue
EN Enable BOOL 1
IN Input value REAL 0.0
MIN Minimum value REAL 0.0
Table 15-26 Output Table for MIN
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT_MIN Minimum value output REAL 0.0
The MIN Block
15-27SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
15.14 MINMAX (Minimum and Maximum Value)
The MINMAX function block (FB392) tracks both the minimum and themaximum values of a variable over time. When the MINMAX function blockexecutes, the input value is assigned to both the minimum and maximumvalues. When a new input is less than the current minimum value, the newinput is assigned to the minimum value. When a new input exceeds themaximum value, the new input is assigned to the maximum value.
If you choose to write your program in SCL, the syntax for this function isas follows:
MINMAX(IN := real_1, MIN := real_2, MAX := real_3);
Figure 15-23 shows an example of how the MINMAX function block works.
IN MIN
1
2
2
0
3
2
1
1
0
0
MAX
2
2
2
2
3
Figure 15-23 MINMAX Example
Overview
15-28 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
MINMAX (continued)
The MINMAX function block is shown in Figure 15-24, and its inputs andoutputs are described in Table 15-27 and Table 15-28.
1
0.0
mnmx_8
MINMAXMinmax Value OB35
1
ENO BOBO EN
R IN
0.0
0.0
R MIN
R MAX
OUT_MIN R
OUT_MAX R
Figure 15-24 MINMAX Block
Table 15-27 Input Table for MINMAX
Element Description Type InitialValue
EN Enable BOOL 1
MIN Minimum value REAL 0.0
MAX Maximum value REAL 0.0
IN Input value REAL 0.0
Table 15-28 Output Table for MINMAX
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT_MIN Minimum value output REAL 0.0
OUT_MAX Maximum value output REAL 0.0
The MINMAX Block
15-29SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
15.15 RIGHT_SH (Right Shift)
The RIGHT_SH function (FC928) moves the bits of a word to the right (fromthe most significant bit towards the least significant bit) and sets thevacated slots on the left to the value of the most significant (sign) bit. Valuesto the right of the shifted bits are lost.
If you choose to write your program in SCL, the syntax for this function isas follows:
RET_VAL := RIGHT_SH(IN_VAR := in_1, BIT_NUM := int_2);
Figure 15-25 shows an example of how the RIGHT_SH function works.
0 1 0 0 0 1 111 0 0 0 0 00
Most significant bit
Binary equivalent of signed integer value (IN_VAR): --32621
Signed integer value after binary value is shifted (RET_VAL): --4078
0 1 0 0 010 0 0 0 001 1 1
0
1
RET_VAL := RIGHT_SH(IN_VAR :=--32621, BIT_NUM := 3);
Figure 15-25 RIGHT_SH Example
Overview
15-30 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
RIGHT_SH (continued)
The RIGHT_SH function is shown in Figure 15-26, and its inputs andoutputs are described in Table 15-29 and Table 15-30.
1
0
0
rshift_2
RIGHT_SHRight Shift OB35
1
ENO BO
RET_VAL W
BO EN
W IN_VAR
I BIT_NUM
Figure 15-26 RIGHT_SH Function
Table 15-29 Input Table for RIGHT_SH
Element Description Type InitialValue
EN Enable BOOL 1
IN_VAR Word to be shifted WORD 16#0
BIT_NUM Number of places to be shifted to the right INT 0
Table 15-30 Output Table for RIGHT_SH
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Word that results from shifting the bits WORD 16#0
The RIGHT_SHBlock
15-31SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
15.16 ROUND (Round)
The ROUND function (FC926) changes a real number to the nearest integer.Values with the decimal portion greater than .5 are rounded to the higherinteger; values less than .5 are rounded to the lower integer. For example,for the IN real number 4.7 the ROUND function returns the integerRET_VAL of 5.
For values with a decimal portion of .5, the ROUND function treats odd andeven numbers differently, as follows:
• For odd numbers (x) of the form x.5, ROUND returns the value of x + 1.For example, 1.5 is rounded to 2.
• For even numbers (x) of the form x.5, ROUND returns the value of x.For example, 4.5 is rounded to 4.
If you choose to write your program in SCL, the syntax for this function isas follows:
RET_VAL := ROUND(IN := real_1);
Overview
15-32 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
ROUND (continued)
The ROUND function is shown in Figure 15-27, and its inputs and outputsare described in Table 15-31 and Table 15-32.
1
0.0
rnd_35
ROUNDRound OB35
1
ENO BO
RET_VAL I
BO EN
R IN
Figure 15-27 ROUND Function
Table 15-31 Input Table for ROUND
Element Description Type InitialValue
EN Enable BOOL 1
IN Real number to be rounded REAL 0.0
Table 15-32 Output Table for ROUND
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Rounded integer value INT 0
The ROUND Block
15-33SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
15.17 SCL_BLK (Scale)
The SCL_BLK function block (FB387) takes an integer value (IN) andconverts it to a real value in engineering units between a low and a highoutput limit (LROUT and HROUT) that you specify. The result is written inOUT. SCL_BLK uses the equation:
OUT = [IN -- LRIN/(HRIN -- LRIN)*(HROUT -- LROUT)] + LROUT
The values LRIN and HRIN are set based upon whether the input value isbipolar or unipolar, and specify the input range limits.
To get a specific integer input type for S7 I/O, follow the instructions below:
• Bipolar: Set the HRIN input to 27648 and the LRIN to --27648.
• Unipolar: Set the HRIN input to 27648 and the LRIN to 0.
• Twenty-Percent Offset: Set the HRIN input to 27648 and the LRIN to5530.
You can select reverse scaling by programming LROUT greater than HROUT.With reverse scaling, the value of the output decreases as the value of theinput increases.
The inputs REN and RDIS are included in this function block forcompleteness in replicating APT functionality. See page 1-12 for adescription.
If the input integer value is outside the range specified by LRIN and HRIN,the output OUT is clamped to the nearer of either LROUT or HROUT, and anerror is returned. The signal state of ENO is set to 0.
Overview
Error Information
15-34 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
SCL_BLK (continued)
The SCL_BLK function block is shown in Figure 15-28, and its inputs andoutputs are described in Table 15-33 and Table 15-34.
OB351
BO EN
scale_6
SCL_BLK
ENO BO1
Scale Block
BO NRDY
BO REN
OUT R
R LROUT
R HROUT
0
0
1
0
1.0
0.0
0
0 ENABLD BO
I IN
I LRIN
I HRIN
BO ENABL
BO RDIS0
Figure 15-28 SCL_BLK Block
The SCL_BLKBlock
15-35SIMATIC PCS 7 OSx 4.1.2 Library Math Functions
Table 15-33 Input Table for SCL_BLK
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
IN Integer input value INT 0
HRIN Input high range INT 1
LRIN Input low range INT 0
HROUT Output high range REAL 1.0
LROUT Output low range REAL 0.0
Table 15-34 Output Table for SCL_BLK
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
OUT Scaled real output REAL 0.0
15-36 SIMATIC PCS 7 OSx 4.1.2 LibraryMath Functions
15.18 TRUNC (Truncate)
The TRUNC function (FC927) returns the integer portion of a real number;that is, it truncates a real number by eliminating its fractional portion andreturning only its integer portion. For example, for the IN real number2.718, the TRUNC function returns the integer RET_VAL of 2.
If you choose to write your program in SCL, the syntax for this function isas follows:
RET_VAL := TRUNC(IN := real_1);
The TRUNC function is shown in Figure 15-29, and its inputs and outputsare described in Table 15-35 and Table 15-36.
1
0.0
tumc_3
TRUNCTruncate OB35
1
ENO BO
RET_VAL I
BO EN
R IN
Figure 15-29 TRUNC Function
Table 15-35 Input Table for TRUNC
Element Description Type InitialValue
EN Enable BOOL 1
IN Real number to be truncated REAL 0.0
Table 15-36 Output Table for TRUNC
Element Description Type InitialValue
ENO Output valid BOOL 0
RET_VAL Truncated integer value INT 0
16-1SIMATIC PCS 7 OSx 4.1.2 Library Instructions
Chapter 16
Instructions
16.1 Understanding SCL Instructions 16-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.2 BITS_INT (Bits to Integer) 16-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.3 INT_BITS (Integer to Bits) 16-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.4 INTERPOL (Interpolate) 16-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.5 LOAD_ARR (Load Real Array) 16-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.6 LOAD_IAR (Load Integer Array) 16-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.7 LOOKUP (Lookup Table) 16-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.8 PACKBITS (Pack Bits) 16-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.9 UNPKBIT (Unpack Bits) 16-13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16-2 SIMATIC PCS 7 OSx 4.1.2 LibraryInstructions
16.1 Understanding SCL Instructions
The functions described in this chapter are SCL instructions. They aredesigned to help you manipulate data in your program. These objects cannotbe displayed in CFC and must be used in conjunction with your SCLprograms as functions.
The OSx Library provides the following instructions:
• BITS_INT, INT_BITS, PACKBITS, and UNPKBIT allow you to convertbetween a series of binary bits and an integer.
• LOAD_ARR and LOAD_IAR allow you to initialize arrays within yourprogram.
• INTERPOL and LOOKUP allow you to use tables to generate nonlineartransformations of your input.
16-3SIMATIC PCS 7 OSx 4.1.2 Library Instructions
16.2 BITS_INT (Bits to Integer)
The BITS_INT function (FC915) moves an array of 16 Boolean values intoan integer variable. The returned integer value is the decimal equivalent ofthe binary value constructed from the bit values of the Boolean array. TheBITS_INT function moves the first element of an array into the mostsignificant bit of the integer (Figure 16-1).
The PACKBITS function (Section 16.8) also moves an array of 16 Booleanvalues into an integer variable, but it moves the first element of the arrayinto the least significant bit of the integer.
Because BITS_INT uses an array type, it cannot be displayed in a CFC.BITS_INT must be called from external SCL code. The syntax for thisinstruction is as follows:
RET_VAL := BITS_INT(BITS_ARR := bits_array_1);
Figure 16-1 shows how the BITS_INT instruction works.
[ 16 ]
[ 15 ]
[ 14 ]
[ 13 ]
[ 12 ]
[ 11 ]
[ 10 ]
[ 9 ]
[ 8 ]
[ 7 ]
[ 6 ]
[ 5 ]
[ 4 ]
[ 3 ]
[ 2 ]
[ 1 ]
1100100100000000
MSB LSB
bit_array_1
RET_VAL = 147
RET_VAL := BITS_INT(BITS_ARR := bit_array_1);
Figure 16-1 BITS_INT Example
16-4 SIMATIC PCS 7 OSx 4.1.2 LibraryInstructions
16.3 INT_BITS (Integer to Bits)
The INT_BITS function (FC919) converts an integer value to an array of 16Boolean values. The INT_BITS function moves the most significant bit ofthe integer into the first element of the array.
The UNPKBIT function (Section 16.9) also converts an integer value to aBoolean array, but it moves the least significant bit of the integer into thefirst element of an array.
Because INT_BITS uses an array type, it cannot be displayed in a CFC.INT_BITS must be called from external SCL code. The syntax for thisinstruction is as follows:
INT_BITS(INT_VAR := int_var_1, BITS_ARR := bit_array_1);
BITS_ARR is a 16-bit Boolean array. INT_VAR contains the integer that is tobe converted to the bits array.
If you want to use the result of the INT_BITS instruction in a CFC, youmust first set another variable equal to each array value used in the CFC,since array elements cannot be inputs to CFCs in the Engineering Toolset.
16-5SIMATIC PCS 7 OSx 4.1.2 Library Instructions
Figure 16-2 shows how the INT_BITS instruction works.
[ 1 ]
[ 2 ]
[ 3 ]
[ 4 ]
[ 5 ]
[ 6 ]
[ 7 ]
[ 8 ]
[ 9 ]
[ 10 ]
[ 11 ]
[ 12 ]
[ 13 ]
[ 14 ]
[ 15 ]
[ 16 ]
0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 1
MSB LSB
bit_array_1
int_var_1 = 147
INT_BITS (INT_VAR := 147, BITS_ARR := bit_array_1);
Figure 16-2 INT_BITS Example
16-6 SIMATIC PCS 7 OSx 4.1.2 LibraryInstructions
16.4 INTERPOL (Interpolate)
The INTERPOL function (FC918) calculates a value between two knownvalues. INTERPOL first locates an input value in a fixed-size input array of11 values, and then determines the output according to the following rules:
• If the input is equal to an element of the input array, the output isassigned the value of the corresponding element in the output array.
• If the input falls between two elements in the array, INTERPOLcalculates the relative position between the two elements and uses thiscalculation in determining the output.
• If the input is less than the value of the first (lowest) element in theinput array, the output is assigned a value less than the value of thefirst element in the output array. This value is based on therelationship calculated between the input value and the values of thefirst two elements in the input array.
• If the input is greater than the value of the last (highest) element inthe input array, the output is assigned a value greater than the value ofthe last element in the output array. This value is based on therelationship calculated between the input value and the values of thelast two elements in the input array.
For another method of calculating an output value based on the relativeposition of an input value in a fixed-size array of 11 values, see theLOOKUP function block in Section 16.7.
NOTE: When you declare the arrays that you want to use with anINTERPOL function block, you must specify 11 as the number of elementsin each array. The values in each array must be arranged in ascendingorder. If you need fewer than 11 elements, set all of the remaining valuesequal to the last (highest) value in your array.
16-7SIMATIC PCS 7 OSx 4.1.2 Library Instructions
Because INTERPOL uses an array type, it cannot be displayed in a CFC.INTERPOL must be called from external SCL code. The syntax for thisinstruction is as follows:
RET_VAL := INTERPOL (XIN := real_number,IN_ARR := array_1, OUT_ARR := array_2);
Figure 16-3 shows how the INTERPOL instruction works.
XIN = 0.5 RET_VAL = 765.0
Input value Output valueInput Array
array_1[1] = 0.2
array_1[5] = 1.0
array_1[4] = 0.8
array_1[3] = 0.6
array_1[2] = 0.4
Output Array
array_2[1] = 750.0
array_2[5] = 790.0
array_2[4] = 780.0
array_2[3] = 770.0
array_2[2] = 760.0
array_1[11] = 2.2
array_1[10] = 2.0
array_2[11] = 850.0
array_2[10] = 840.0
.
.
.
.
.
.
RET_VAL:= INTERPOL (XIN:=0.5, IN_ARR:=array_1, OUT_ARR:=array_2);
Figure 16-3 INTERPOL Example
16-8 SIMATIC PCS 7 OSx 4.1.2 LibraryInstructions
16.5 LOAD_ARR (Load Real Array)
The LOAD_ARR function (FC922) assigns a single value to all the elementsof a fixed-size array of 128 values. Only real values are supported for thisfunction.
Because LOAD_ARR uses an array type, it cannot be displayed in a CFC.LOAD_ARR must be called from external SCL code. The syntax for thisinstruction is as follows:
LOAD_ARR(REAL_VAR:=real_number, REAL_ARR:=real_array);
Figure 16-4 shows how the LOAD_ARR instruction works.
out_arr
out_arr[1] = 0.5
REAL_VAR= 0.5Input value:
out_arr[128] = 0.5
out_arr[4] = 0.5
out_arr[3] = 0.5
out_arr[2] = 0.5
LOAD_ARR(REAL_VAR:=0.5, REAL_ARR:=out_arr);
.
.
.
Figure 16-4 LOAD_ARR Example
16-9SIMATIC PCS 7 OSx 4.1.2 Library Instructions
16.6 LOAD_IAR (Load Integer Array)
The LOAD_IAR function (FC931) assigns a single value to all the elementsof a fixed-size array of 256 values. Only integer values are supported forthis function.
Because LOAD_IAR uses an array type, it cannot be displayed in a CFC.LOAD_IAR must be called from external SCL code. The syntax for thisinstruction is as follows:
LOAD_IAR(INT_VAR:=integer, INT_ARR:=int_array);
Figure 16-5 shows how the LOAD_IAR instruction works.
out_arr
out_arr[1] = 2
INT_VAR = 2Input value:
out_arr[256] = 2
out_arr[4] = 2
out_arr[3] = 2
out_arr[2] = 2
LOAD_IAR(INT_VAR:=2, INT_ARR:=out_arr);
.
.
.
Figure 16-5 LOAD_IAR Example
16-10 SIMATIC PCS 7 OSx 4.1.2 LibraryInstructions
16.7 LOOKUP (Lookup Table)
The LOOKUP function (FC923) calculates an output value based on therelative position of an input value in a fixed-size array of 11 values.LOOKUP compares the input to the values in the input array and then usesone of the following techniques to determine the output:
• If the input is equal to an element of the input array, the output isassigned the value of the corresponding element in the output array.
• If the input is not equal to an element in the input array, LOOKUPuses the value of the highest element that is not greater than the input.The output is assigned the value of the corresponding element in theoutput array.
• If the input is less than the value of the first (lowest) element in theinput array, the output is assigned the value of the first element in theoutput array.
• If the input is greater than the value of the last (highest) element inthe input array, the output is assigned the value of the last element inthe output array.
For another method of calculating an output value based on the relativeposition of an input value in a fixed-size array of 11 values, see theINTERPOL function block in Section 16.4.
NOTE: When you declare the arrays that you want to use with a LOOKUPfunction block, you must specify 11 as the number of elements in each array.The values in each array must be arranged in ascending order. If you needfewer than 11 elements, set all of the remaining values equal to the last(highest) value in your array.
16-11SIMATIC PCS 7 OSx 4.1.2 Library Instructions
Because LOOKUP uses an array type, it cannot be displayed in a CFC.LOOKUP must be called from external SCL code. The syntax for thisinstruction is as follows:
XOUT := LOOKUP(XIN := real, IN_ARR := real_array_1,OUT_ARR := real_array_2);
Figure 16-6 shows how the LOOKUP instruction works.
XIN = 0.5 XOUT= 760.0
Input value Output value
real_array_1
real_array_1[1] = 0.2
real_array_1[5] = 1.0
real_array_1[4] = 0.8
real_array_1[3] = 0.6
real_array_1[2] = 0.4
real_array_2
real_array_2[1] = 750.0
real_array_2[5] = 790.0
real_array_2[4] = 780.0
real_array_2[3] = 770.0
real_array_2[2] = 760.0
real_array_1[11] = 2.2
real_array_1[10] = 2.0
real_array_2[11] = 850.0
real_array_2[10] = 840.0
.
.
.
.
.
.
XOUT := LOOKUP(XIN := 0.5, IN_ARR := real_array_1, OUT_ARR := real_array_2);
Figure 16-6 LOOKUP Example
16-12 SIMATIC PCS 7 OSx 4.1.2 LibraryInstructions
16.8 PACKBITS (Pack Bits)
The PACKBITS function (FC924) moves an array of up to 16 Boolean valuesinto an integer variable. The returned integer value is the decimalequivalent of the binary value constructed from the bit values of theBoolean array. The PACKBITS function moves the first element of the arrayinto the least significant bit of the integer.
The BITS_INT function (Section 16.2) also moves an array of 16 Booleanvalues into an integer variable, but it moves the first element of an arrayinto the most significant bit of the integer.
Because PACKBITS uses an array type, it cannot be displayed in a CFC.PACKBITS must be called from external SCL code. The syntax for thisinstruction is as follows:
INT := PACKBITS(BITS_ARR := bits_array_1);
Figure 16-7 shows how the PACKBITS instruction works.
0 0 0 0 0 0 1 110 0 0 0 0 00
INT = 19
bits_array_1: size = 6
bits_array_1[1] = 1
bits_array_1[4] = 0
bits_array_1[5] = 1
bits_array_1[3] = 0
bits_array_1[2] = 1
bits_array_1[6] = 0
LSBMSB
INT := PACKBITS (BITS_ARR := bits_array_1);
Figure 16-7 PACKBITS Example
16-13SIMATIC PCS 7 OSx 4.1.2 Library Instructions
16.9 UNPKBIT (Unpack Bits)
The UNPKBIT function (FC929) converts an integer value to an array of 16Boolean values. The UNPKBIT function moves the least significant bit ofthe integer into the first element of an array (Figure 16-8).
The INT_BITS function (Section 16.3) also converts an integer value to aBoolean array, but it moves the most significant bit of the integer into thefirst element of the array.
Because UNPKBIT uses an array type, it cannot be displayed in a CFC.UNPKBIT must be called from external SCL code. The syntax for thisinstruction is as follows:
UNPKBIT(IN := integer, OUT := bits_array_1);
OUT is a 16-bit Boolean array. IN is the integer that contains the bits to bemoved.
Figure 16-8 shows how the UNPKBIT instruction works.
0 0 0 0 0 0 1 110 0 0 0 0 00
IN = 19
bits_array_1: size = 6
bits_array_1[1] = 1
bits_array_1[5] = 1
bits_array_1[4] = 0
bits_array_1[3] = 0
bits_array_1[2] = 1
bits_array_1[6] = 0
LSBMSB
UNPKBIT(IN := 19, OUT :=bits_array_1);
Figure 16-8 UNPKBIT Example
16-14 SIMATIC PCS 7 OSx 4.1.2 LibraryInstructions
17-1SIMATIC PCS 7 OSx 4.1.2 Library Limiters
Chapter 17
Limiters
17.1 OUT_LIM (Output Limiter) 17-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2 RATE_LIM (Rate Limiter) 17-4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17-2 SIMATIC PCS 7 OSx 4.1.2 LibraryLimiters
17.1 OUT_LIM (Output Limiter)
The output limiter function block (FB373) checks for an out-of-range inputand keeps the output of the block within the high and low limits that youspecify.
• If the value of the input IN is less than the value of the low limit LLIM,the OUT_LIM block assigns the value of LLIM to the output OUT.
• If the value of the input IN is greater than the value of the high limitHLIM, the OUT_LIM block assigns the value of HLIM to the output OUT.
The inputs REN and RDIS are included in this function block forcompleteness in replicating APT functionality. See page 1-12 for adescription.
When you use an OUT_LIM block, the following function block must also bepresent in the Blocks folder of your S7 program:
• RD_SINFO (SFC6)
The OUT_LIM function block is shown in Figure 17-1, and its inputs andoutputs are described in Table 17-1 and Table 17-2.
OB351
BO EN
olim_2
OUT_LIM
ENO BO1
Output Limiter
R IN
BO RDIS
BO NRDY
ENABLD BO
OUT R
0
0
1.0
0
0.0
0.0
BO ENABL
BO REN
R HLIM
R LLIM
0
Figure 17-1 OUT_LIM Block
Overview
Required Block
The OUT_LIMBlock
17-3SIMATIC PCS 7 OSx 4.1.2 Library Limiters
Table 17-1 Input Table for OUT_LIM
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
HLIM High limit value REAL 1.0
LLIM Low limit value REAL 0.0
IN Input value REAL 0.0
Table 17-2 Output Table for OUT_LIM
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
OUT Output value REAL 0.0
17-4 SIMATIC PCS 7 OSx 4.1.2 LibraryLimiters
17.2 RATE_LIM (Rate Limiter)
The rate limiter function block (FB374) can be used as a ramp function tochange the output at a specified rate until it is equal to the input.
The rate limiter block executes at the rate UNIT_T that you define. For thetiming to be accurate, be sure that UNIT_T is a multiple of SAMPLE_T, andthat SAMPLE_T is set to the same value as the OB that calls the block. Forexample, for OB35, which calls the block every 100 ms, set SAMPLE_T to 0.1.
On each execution, the block compares the input IN to the output OUT. If thevalues of the input and output are not equal (EQ=1), the rate limiter blocklowers or raises the value of the output to decrease the difference betweenthe two. The rate at which the value of the output changes is determined bythe rate limit RLIM that you specify.
For example, if the initial value of the output is 140.0, the rate limit is 1.0units/sample, the block is executed at one-second intervals (UNIT_T=1.0),and the input is 150.0, the maximum change each second that the blockexecutes is 1. Therefore, it takes 10 executions, or 10 seconds, for the outputto reach the steady-state value of the input at 150.0.
If the output is advancing from 140 to 145 in increments of two, the outputsequence is
140→142→144→145
To ramp an output variable from the current value to another, change theinput value to the desired output. The output then changes to the input atthe rate that you specify.
NOTE: To ensure a bumpless transfer, assign the value of the input to theoutput before you enable the block.
The inputs REN and RDIS are included in this function block forcompleteness in replicating APT functionality. See page 1-12 for adescription.
When you use a RATE_LIM block, the following function block must also bepresent in the Blocks folder of your S7 program:
• RD_SINFO (SFC6)
Overview
Required Block
17-5SIMATIC PCS 7 OSx 4.1.2 Library Limiters
The RATE_LIM function block is shown in Figure 17-2, and its inputs andoutputs are described in Table 17-3 and Table 17-4.
OB351
BO EN
rlim_5
RATE_LIM
ENO BO1
Rate Limiter
R IN
ENABLD BO
EQ BO
0
0
1.0
0
0.0
BO ENABL
BO REN
R UNIT_T
R RLIM
0.1
BO RDIS
0.0
BO NRDY
0
R SAMPLE_T
OUT R
Figure 17-2 RATE_LIM Block
The RATE_LIMBlock
17-6 SIMATIC PCS 7 OSx 4.1.2 LibraryLimiters
RATE_LIM (continued)
Table 17-3 Input Table for RATE_LIM
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
SAMPLE_T Sample time (in seconds) REAL 0.1
UNIT_T Time between executions (in seconds) REAL 1.0
IN Input value REAL 0.0
RLIM Rate limit value REAL 0.0
Table 17-4 Output Table for RATE_LIM
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
EQ Input equal to output BOOL 0
OUT Output value REAL 0.0
18-1SIMATIC PCS 7 OSx Library Manual Selectors
Chapter 18
Selectors
18.1 Understanding Selector Blocks 18-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2 AVG_SEL (Average Selector) 18-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3 HIGH_SEL (High Selector) 18-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.4 ISWT_SEL (Inswitch Selector) 18-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.5 LOW_SEL (Low Selector) 18-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.6 MED_SEL (Median Selector) 18-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.7 OSWT_SEL (Outswitch Selector) 18-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.8 THR_SEL (Threshold Selector) 18-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-2 SIMATIC PCS 7 OSx 4.1.2 LibrarySelectors
18.1 Understanding Selector Blocks
Selector blocks provide a means to select one signal from a set of up to foursignals. Four basic types of selector blocks are available:
• High, low, and inswitch selectors allow you to choose from four inputsand send the selected signal to an output.
• Median and average selectors allow you to choose from three inputsand send the median or average value to an output.
• The outswitch selector allows you to send an input signal to one of fouroutputs.
• The threshold selector allows you to determine whether or not theinput value has gone above or below a limit. If the value is outside thelimit, a Boolean variable or discrete output is set to true or 1.
The inputs REN and RDIS are included in the selector blocks forcompleteness in replicating APT functionality. See page 1-12 for adescription.
18-3SIMATIC PCS 7 OSx Library Manual Selectors
18.2 AVG_SEL (Average Selector)
The AVG_SEL function block (FB375) computes a numerical average fromthree inputs.
Before the block performs its calculation, it adds and subtracts from themedian of the three inputs the value that you specify as the maximumdeviation. If an input is greater than or equal to this range, that input is notused in the calculation; the average is computed from the remaining values.
For example, assume three inputs as shown in Figure 18-1: IN1=155.0,IN2=150.0, and IN3=158.0 with a maximum deviation TVAL of 3.0. Themedian value is 155.0; the other two values are greater than or equal to therange of 155.0 +/-- 3.0; therefore, only one value is used and the output OUTis 155.0.
If, however, the inputs are IN1=155.0, IN2=162.0, and IN3=160.0 with amaximum deviation TVAL of 3.0, then the median value is 160.0, and theoutput OUT would be 161.0: the average of 160 and 162.
AVERAGE SELECTOR
A
AVERAGE SELECTOR
B C
OUT
155.0 150.0 158.0
median = 155.0maximum deviation =3.0
average = 155.0/1
155
not within range155.0 +/-- 3.0
A B C
OUT
155.0 162.0 160.0
161
median = 160.0maximum deviation =3.0
average = (160.0+162.0)/2
not within range160.0 +/-- 3.0
Figure 18-1 Selecting an Average
When you use an AVG_SEL block, the following function block must also bepresent in the Blocks folder of your S7 program:
• RD_SINFO (SFC6)
Overview
Required Block
18-4 SIMATIC PCS 7 OSx 4.1.2 LibrarySelectors
AVG_SEL (continued)
The AVG_SEL function block is shown in Figure 18-2, and its inputs andoutputs are described in Table 18-1 and Table 18-2.
1
0
0
0
avg_36
AVG_SELAverage Select OB35
1
ENO BOBO EN
BO NRDY
R IN1
0
0.0
R IN2
R IN3
R TVAL
0.0
0.0
1.0
BO ENABL
BO REN
BO RDIS
ENABLD BO
IN1OK BO
IN2OK BO
IN3OK BO
POS I
STAT I
OUT R
Figure 18-2 AVG_SEL Block
The AVG_SELBlock
18-5SIMATIC PCS 7 OSx Library Manual Selectors
Table 18-1 Input Table for AVG_SEL
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
IN1 Input 1 REAL 0.0
IN2 Input 2 REAL 0.0
IN3 Input 3 REAL 0.0
TVAL Maximum deviation REAL 1.0
Table 18-2 Output Table for AVG_SEL
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
IN1OK Input 1 is within deviation range BOOL 0
IN2OK Input 2 is within deviation range BOOL 0
IN3OK Input 3 is within deviation range BOOL 0
POS Position of median (1, 2, or 3) INT 0
STAT Number of inputs used (1, 2, or 3) INT 0
OUT Average of the inputs that are within the deviation range REAL 0.0
18-6 SIMATIC PCS 7 OSx 4.1.2 LibrarySelectors
18.3 HIGH_SEL (High Selector)
The HIGH_SEL function block (FB376) selects the highest of up to fourenabled inputs. For example, from the inputs IN1=12.1, IN2=15.6, IN3=9.7,and IN4=14.4, the HIGH_SEL returns an output value OUT of 15.6.
If two inputs are equal, and their value is the highest, the position outputPOS will indicate the first input with that value. For example, if the inputsare IN1=0.1, IN2=0.2, IN3=0.4, and IN4=0.4, then OUT=0.4 and POS=3.
You can disable an input that you do not want to use by setting the Booleanswitch for that input to 0. For example, to disable IN4, set SW4 equal to 0.
When you use a HIGH_SEL block, the following function block must also bepresent in the Blocks folder of your S7 program:
• RD_SINFO (SFC6)
Overview
Required Block
18-7SIMATIC PCS 7 OSx Library Manual Selectors
The HIGH_SEL function block is shown in Figure 18-3, and its inputs andoutputs are described in Table 18-3 and Table 18-4.
1
0
0
0
hi_12
HIGH_SELHigh Selector OB35
1
ENO BOBO EN
BO NRDY
R IN1
0
R IN2
R IN3
1
0.0
1
ENABLD BO
POS I
OUT R
0.0
1
R IN4
0.0
1
0.0
BO ENABL
BO REN
BO RDIS
BO SW1
BO SW2
BO SW3
BO SW4
Figure 18-3 HIGH_SEL Block
The HIGH_SELBlock
18-8 SIMATIC PCS 7 OSx 4.1.2 LibrarySelectors
HIGH_SEL (continued)
Table 18-3 Input Table for HIGH_SEL
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
SW1 Enable input 1 BOOL 1
IN1 Input 1 REAL 0.0
SW2 Enable input 2 BOOL 1
IN2 Input 2 REAL 0.0
SW3 Enable input 3 BOOL 1
IN3 Input 3 REAL 0.0
SW4 Enable input 4 BOOL 1
IN4 Input 4 REAL 0.0
Table 18-4 Output Table for HIGH_SEL
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
POS Position of the highest input (1, 2, 3, or 4) INT 0
OUT Value of the highest input REAL 0.0
18-9SIMATIC PCS 7 OSx Library Manual Selectors
18.4 ISWT_SEL (Inswitch Selector)
The ISWT_SEL function block (FB377) allows you to select one of fourinputs to send to an output. You select the input by setting the value of POS(position).
For example, if IN1=3.0, IN2=7.4, IN3=15.1, and IN4=21.6, and you set POSequal to 3, the ISWT_SEL returns an output of 15.1. If you change POS to 2,the ISWT_SEL returns an output of 7.4.
When you use an ISWT_SEL block, the following function block must alsobe present in the Blocks folder of your S7 program:
• RD_SINFO (SFC6)
The ISWT_SEL function block is shown in Figure 18-4, and its inputs andoutputs are described in Table 18-5 and Table 18-6.
1
0
0
0
insw_10
ISWT_SELInswitch Selec OB35
1
ENO BOBO EN
BO NRDY
R IN1
R IN2
R IN3
0
ENABLD BO
OUT R
0
0.0
R IN4
0.0
0.0
0.0
BO ENABL
BO REN
BO RDIS
I POS
Figure 18-4 ISWT_SEL Block
Overview
Required Block
The ISWT_SELBlock
18-10 SIMATIC PCS 7 OSx 4.1.2 LibrarySelectors
ISWT_SEL (continued)
Table 18-5 Input Table for ISWT_SEL
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
POS Position of input selected (1, 2, 3, or 4) INT 0
IN1 Input 1 REAL 0.0
IN2 Input 2 REAL 0.0
IN3 Input 3 REAL 0.0
IN4 Input 4 REAL 0.0
Table 18-6 Output Table for ISWT_SEL
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
OUT Selected input value REAL 0.0
18-11SIMATIC PCS 7 OSx Library Manual Selectors
18.5 LOW_SEL (Low Selector)
The LOW_SEL function block (FB378) selects the lowest of up to fourenabled inputs. For example, from the inputs IN1=121, IN2=156, IN3=97, andIN4=144, the LOW_SEL returns an output value OUT of 97.
If two inputs are equal, and their value is the lowest, the position outputPOS will indicate the first input with that value. For example, if the inputsare IN1=0.1, IN2=0.1, IN3=0.2, and IN4=0.4, then OUT=0.1 and POS=1.
You can disable an input that you do not want to use by setting the Booleanswitch for that input to 0. For example, to disable IN4, set SW4 equal to 0.
When you use a LOW_SEL block, the following function block must also bepresent in the Blocks folder of your S7 program:
• RD_SINFO (SFC6)
Overview
Required Block
18-12 SIMATIC PCS 7 OSx 4.1.2 LibrarySelectors
LOW_SEL (continued)
The LOW_SEL function block is shown in Figure 18-5, and its inputs andoutputs are described in Table 18-7 and Table 18-8.
1
0
0
0
low_4
LOW_SELLow Selector OB35
1
ENO BOBO EN
BO NRDY
R IN1
0
R IN2
R IN3
1
0.0
1
ENABLD BO
POS I
OUT R
0.0
1
R IN4
0.0
1
0.0
BO ENABL
BO REN
BO RDIS
BO SW1
BO SW2
BO SW3
BO SW4
Figure 18-5 LOW_SEL Block
The LOW_SELBlock
18-13SIMATIC PCS 7 OSx Library Manual Selectors
Table 18-7 Input Table for LOW_SEL
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
SW1 Enable input 1 BOOL 1
IN1 Input 1 REAL 0.0
SW2 Enable input 2 BOOL 1
IN2 Input 2 REAL 0.0
SW3 Enable input 3 BOOL 1
IN3 Input 3 REAL 0.0
SW4 Enable input 4 BOOL 1
IN4 Input 4 REAL 0.0
Table 18-8 Output Table for LOW_SEL
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
POS Position of the lowest input INT 0
OUT Value of the lowest input REAL 0.0
18-14 SIMATIC PCS 7 OSx 4.1.2 LibrarySelectors
18.6 MED_SEL (Median Selector)
The MED_SEL function block (FB379) selects the numerical median ofthree inputs. Median is not an average. For example, from the inputs IN1=4,IN2=5 and IN3=9, the MED_SEL returns an output value OUT of 5, not theaverage 6. If all inputs are equal, IN1 is selected.
When you use a MED_SEL block, the following function block must also bepresent in the Blocks folder of your S7 program:
• RD_SINFO (SFC6)
The MED_SEL function block is shown in Figure 18-6, and its inputs andoutputs are described in Table 18-9 and Table 18-10.
1
0
0
0
0
0.0
med_6
MED_SELMedian Select OB35
1
ENO BOBO EN
BO NRDY
R IN1
0.0
0.0
R IN2
R IN3
BO ENABL
BO REN
BO RDIS
ENABLD BO
POS I
OUT R
Figure 18-6 MED_SEL Block
Overview
Required Block
The MED_SELBlock
18-15SIMATIC PCS 7 OSx Library Manual Selectors
Table 18-9 Input Table for MED_SEL
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
IN1 Input 1 REAL 0.0
IN2 Input 2 REAL 0.0
IN3 Input 3 REAL 0.0
Table 18-10 Output Table for MED_SEL
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
POS Position of the median INT 0
OUT Value of the median REAL 0.0
18-16 SIMATIC PCS 7 OSx 4.1.2 LibrarySelectors
18.7 OSWT_SEL (Outswitch Selector)
The OSWT_SEL function block (FB380) allows you to send an input signalto any one of four outputs. You select the input by setting the value of POS(position).
For example, if the input IN is 4.5 and the position POS is 3, the value 4.5 issent to the output OUT3. The other OUT outputs retain their previousvalues.
When you use an OSWT_SEL block, the following function block must alsobe present in the Blocks folder of your S7 program:
• RD_SINFO (SFC6)
The OSWT_SEL function block is shown in Figure 18-7, and its inputs andoutputs are described in Table 18-11 and Table 18-12.
1
0
1
outsw_1
OSWT_SELOutswitch Sele OB35
1
ENO BOBO EN
BO NRDY
R IN0.0
ENABLD BO
OUT1 R
0
0
0
BO ENABL
BO REN
BO RDIS
I POS
OUT2 R
OUT3 R
OUT4 R
Figure 18-7 OSWT_SEL Block
Overview
Required Block
The OSWT_SELBlock
18-17SIMATIC PCS 7 OSx Library Manual Selectors
Table 18-11 Input Table for OSWT_SEL
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
IN Input REAL 0.0
POS Position of output to select INT 1
Table 18-12 Output Table for OSWT_SEL
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
OUT1 Output 1 REAL 0.0
OUT2 Output 2 REAL 0.0
OUT3 Output 3 REAL 0.0
OUT4 Output 4 REAL 0.0
18-18 SIMATIC PCS 7 OSx 4.1.2 LibrarySelectors
18.8 THR_SEL (Threshold Selector)
The THR_SEL function block (FB381) determines whether an input valuefalls below or rises above a specified limit.
You can select a high threshold by setting the THRESHOLD input to 1, or alow threshold by setting the THRESHOLD input to 0.
• If you select a high threshold, the Boolean output DOUT becomes true ifthe input value is greater than or equal to the limit value.
• If you select a low threshold, the Boolean output DOUT becomes true ifthe input value is less than or equal to the limit value.
When you use a THR_SEL block, the following function block must also bepresent in the Blocks folder of your S7 program:
• RD_SINFO (SFC6)
The THR_SEL function block is shown in Figure 18-8, and its inputs andoutputs are described in Table 18-13 and Table 18-14.
1
1
0.0
thresh_1
THR_SELThreshold Sel OB35
1
ENO BOBO EN
BO NRDY
R IN
0
0
ENABLD BO
DOUT BO
0.0
0
0
BO ENABL
BO REN
BO RDIS
BO THRESHOL
R LIMIT
Figure 18-8 THR_SEL Block
Overview
Required Block
The THR_SELBlock
18-19SIMATIC PCS 7 OSx Library Manual Selectors
Table 18-13 Input Table for THR_SEL
Element Description Type InitialValue
EN Enable BOOL 1
REN Request enable BOOL 0
RDIS Request disable BOOL 0
ENABL Enable BOOL 0
NRDY Not ready BOOL 0
THRESHOLD Threshold 1=high; 0=low BOOL 0
IN Input REAL 0.0
LIMIT Threshold limit value REAL 0.0
Table 18-14 Output Table for THR_SEL
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
DOUT 1=threshold reached; 0=within limit BOOL 0
18-20 SIMATIC PCS 7 OSx 4.1.2 LibrarySelectors
19-1SIMATIC PCS 7 OSx 4.1.2 Library Arrays
Chapter 19
Arrays
19.1 SEQ_ARY (Sequence Array) 19-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.2 SR_ARY (Shift Register Array) 19-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19.3 TA (Text Array) 19-9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19-2 SIMATIC PCS 7 OSx 4.1.2 LibraryArrays
19.1 SEQ_ARY (Sequence Array)
The SEQ_ARY function block (FB342) is an array of integers that you canuse for many different operations, such as the queuing of data values, or thegeneration of a sequence list of values.
The SEQ_ARY block has two modes of operation: write and read. In thewrite mode, the IN input is written to the array, at the location specified bythe W_PTR input. In the read mode, data is read from the array at theposition specified by the R_PTR input to the OUT output.
Both pointers W_PTR and R_PTR must be greater than or equal to 1 and lessthan or equal to the length LEN of the array.
When the SEQ_ARY function block is in read mode, all write operations areignored. When the block is in write mode, all read operations are ignored.
The length LEN of the array must be greater than or equal to one and lessthan or equal to 256. If LEN is greater than 256, it is clamped at 256; if LENis less than 1, it is clamped at 1.
You must load the sequence array with data before you can use it. To loadthe sequence array, follow the steps below:
1. Set the R_W input to true to put the function block in write mode. (OUTand R_PTR are ignored when the array is in write mode.)
2. Set the W_PTR input to the number of the array position where youwant to begin writing into the array.
3. Set the IN input to the value that you want entered in the W_PTRposition of the array.
4. Change the ADVNC input from false to true to move the value from IN tothe array at the location pointed to by W_PTR. After IN is copied into thearray, the value of W_PTR is incremented by one. The ADVNC input ispositive edge-triggered, and resets to false automatically after theoperation.
For example, if IN is 3 and W_PTR is 1, then the value of 3 is written tothe first position of the array when you trigger the ADVNC input, andthen W_PTR is automatically set to 2, and ADVNC is automatically set tofalse.
5. To continue to write to the array, change the value of IN and trigger theADVNC input (false to true) for each location where you want a newvalue to be stored.
The END output is set to true when the last position of the array has beenfilled. When END is true, no more values can be written to the array.
Overview
19-3SIMATIC PCS 7 OSx 4.1.2 Library Arrays
Now that the array has been loaded, it is ready to be used. To use thesequence array, follow the steps below:
1. Set the R_W input to false to put the block in read mode.
2. Set the R_PTR input to the number of the array position where youwant to start reading from the array.
3. Change the ADVNC input from false to true to read the value stored inthe R_PTR position of the array to the OUT output. After OUT has beenread from the array, the R_PTR input is incremented by one. TheADVNC input is positive edge-triggered, and resets to falseautomatically after the operation.
For example, if R_PTR is 5, then the value is read from the fifth postionof the array to the OUT output when you trigger the ADVNC input, andthen R_PTR is automatically set to 6, and ADVNC is automatically set tofalse.
4. To continue to read from the array, trigger the ADVNC input (false totrue) for each value that you want to read.
The END output is set to true when the last position of the array has beenread to OUT. When the END output is true, no more values can be read fromthe array.
The CLEAR input resets the IN and LEN inputs to their default (initial)values, and sets the values contained in the array to zero. The RESET inputmust be false when CLEAR is set to true to reinitialize the array. SeeTable 19-1 for initial values.
The RESET input is used to set R_W, R_PTR, W_PTR, END, ADVNC, andCLEAR to their default (initial) values. This input resets the block so it canbe used again. See Table 19-1 and Table 19-2 on page 19-5 for initialvalues.
19-4 SIMATIC PCS 7 OSx 4.1.2 LibraryArrays
SEQ_ARY (continued)
The SEQ_ARY function block is shown in Figure 19-1, and its inputs andoutputs are described in Table 19-1 and Table 19-2.
1
0
1
1
seq_1
SEQ_ARYSequence Array OB35
1
ENO BOBO EN
I IN
I LEN
BO R_W
0
0
0
BO ADVNC
BO RESET
BO CLEAR
1
1
I R_PTR
I W_PTR
OUT I
END BO
R_PTR_O I
W_PTR_O I
Figure 19-1 SEQ_ARY Block
The SEQ_ARYBlock
19-5SIMATIC PCS 7 OSx 4.1.2 Library Arrays
Table 19-1 Input Table for SEQ_ARY
Element Description Type InitialValue
EN Enable BOOL 1
IN Input INT 0
LEN Array length (1..256) INT 1
R_W Read/write switch: 1=read, 0=write BOOL 1
ADVNC Advance command BOOL 0
RESET Reset command BOOL 0
CLEAR Clear array command BOOL 0
R_PTR Read pointer INT 1
W_PTR Write pointer INT 1
Table 19-2 Output Table for SEQ_ARY
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output from array INT 0
END End of the array BOOL 0
R_PTR_O Output read pointer INT 0
W_PTR_O Output write pointer INT 0
19-6 SIMATIC PCS 7 OSx 4.1.2 LibraryArrays
19.2 SR_ARY (Shift Register Array)
The SR_ARY function block (FB343) is a special array of integers thatallows you to insert a value into the first element and shift the other valuesin the array down one element.
The length LEN of the array must be greater than or equal to one and lessthan or equal to 256. If LEN is greater than 256, it is clamped at 256; if LENis less than 1, it is clamped at 1.
The first position of the array will be set to the value of IN when the ADVNCinput is triggered (false to true). ADVNC is edge-triggered, meaning that itinserts one value when it is turned from off to on. It must be turned off andthen back on again to insert a second value. When ADVNC is triggered, all ofthe values in the array are shifted down one position, and the OUT output isset to the value in the LEN position of the array.
For example, Figure 19-2 shows an array of five values (LEN = 5) before andafter the ADVNC input has been triggered. Notice that the value of IN (6) iswritten to the first position of the array while the other values are shifteddown a position. The OUT output reflects the value in the last (LEN) positionof the array.
Before ADVNC
array
array[1] = 5
array[5] = 1
array[4] = 2
array[3] = 3
array[2] = 4
After ADVNC
array
array[1] = 6
array[5] = 2
array[4] = 3
array[3] = 4
array[2] = 5
OUT = 1 OUT = 2
LEN = 5
IN = 6
Figure 19-2 Shift Register Array Example
Overview
19-7SIMATIC PCS 7 OSx 4.1.2 Library Arrays
When the RESET input is 1, the block is ready to run. When it is set to 0, itclears the array and sets ENABL, LEN, ADVNC, and OUT to their default(initial) values. See Table 19-3 and Table 19-4 for initial values.
The following inputs have these effects:
• RTR sets RESET to 1
• RTC sets RESET to 0
• REN sets ENABL to 1
• RDIS sets ENABL to 0
When you use an SR_ARY block, the following function block must also bepresent in the Blocks folder of your S7 program:
• RD_SINFO (SFC6)
The SR_ARY function block is shown in Figure 19-3, and its inputs andoutputs are described in Table 19-3 and Table 19-4.
1
0
0
shreg_2
SR_ARYShift Register Array OB35
1
ENO BOBO EN
I IN
0
0
BO RTR
BO RTC
1 BO RESET
0 BO ENABL
BO ADVNC0
0 BO REN
BO RDIS
1 I LEN
ENABLD BO
OUT I
Figure 19-3 SR_ARY Block
Required Blocks
The SR_ARY Block
19-8 SIMATIC PCS 7 OSx 4.1.2 LibraryArrays
SR_ARY (continued)
Table 19-3 Input Table for SR_ARY
Element Description Type InitialValue
EN Enable BOOL 1
REN Request to enable BOOL 0
RDIS Request to disable BOOL 0
RTR Request to reset BOOL 0
RTC Request to clear BOOL 0
ENABL Enable BOOL 0
IN Input value INT 0
LEN Array length (1..256) INT 1
ADVNC Advance command BOOL 0
RESET Reset: 1=ready, 0=reset BOOL 1
Table 19-4 Output Table for SR_ARY
Element Description Type InitialValue
ENO Output valid BOOL 0
ENABLD Enabled BOOL 0
OUT Output INT 0
19-9SIMATIC PCS 7 OSx 4.1.2 Library Arrays
19.3 TA (Text Array)
The TA function block (FB412) allows you to write and read text strings toand from a data block. You create an array of text strings in a separate datablock which is referenced through the symbol table.
When you create the data block, it can contain only string declarations. Thestring length must be exactly 30 characters. The block must consist entirelyof 30-character strings. When the TA block executes, if these conditions arenot met, an error value is returned in the ERROR output. Table 19-5contains the error codes for the ERROR output.
Table 19-5 TA Error Codes
Error Code Description
16#0001 The data block length is incorrect.
16#0002 One or more elements in the array are not strings that areexactly 30 characters long.
16#0003 Index value is less than 1.
16#0004 Index value is greater than the number of the last text stringin the array of the data block.
16#80A1 The data block number specified is either 0 or greater than themaximum allowed for the controller.
16#80B1 The data block does not exist in the CPU.
16#80B2 The data block was created using the keyword UNLINKED.
You must declare the data block in the Symbol Table. The name given thedata block is then entered into the ARRAY_DB input. You must assign a datablock number to the symbol that is outside of the data block range used forCFC instances. That range is displayed in the Settings for Compiling dialogbox (see page 1-4).
In order to read text strings from the data block, you set the IDX input to thelocation of the string in the array. For example, if IDX is 2, then the secondstring in the data block is transferred to the OUT output on each execution.If IDX is less than 1 or greater than the number of the last text string in thearray, an error is returned to the ERROR output and ENO is set to 0.
Overview
19-10 SIMATIC PCS 7 OSx 4.1.2 LibraryArrays
TA (Text Array) (continued)
To write a text string to the data block, write the text string of 30 charactersto the IN input. Then set IDX input to the location in the data block whereyou want the text string to be stored. For example, if you want the string tobe the fourth string in the array, set IDX to 4. Now set the WRITE input to 1,which causes the IN string to be written into the array. The WRITE input isautomatically reset by the TA function block. Be aware that it is possible formultiple TA blocks to point to the same data block.
In order to use the TA block, you must set the minimum reserved FCnumber to a value of 2. To make this change see the procedure on page 1-4.
When you use an TA block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• CONCAT (FC2)
• LENGTH (FC21)
• MID (FC26)
• TEST_DB (SFC24)
The TA function block is shown in Figure 19-4, and its inputs and outputsare described in Table 19-6 and Table 19-7.
1
’ ’
Ta_1
TAText Array OB35
1
ENO BOBO EN
0
0
I IDX
WRITE
0 DB ARRAY_DB
SN IN
ERROR W
OUT SN
Figure 19-4 TA Block
Required Blocks
The TA Block
19-11SIMATIC PCS 7 OSx 4.1.2 Library Arrays
Table 19-6 Input Table for TA
Element Description Type InitialValue
EN Enable BOOL 1
ARRAY_DB Data block containing the text array BLOCK_DB 0
IN Input text string to array STRING ’ ’
IDX Index into the array INT 0
WRITE Write new value to array BOOL 0
Table 19-7 Output Table for TA
Element Description Type InitialValue
ENO Output valid BOOL 0
ERROR Error code WORD 16#0
OUT Text string up to 30 characters from the DB STRING ’ ’
19-12 SIMATIC PCS 7 OSx 4.1.2 LibraryArrays
20-1SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
Chapter 20
Elementary OSx Types
20.1 Understanding Elementary OSx Types 20-2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.2 CALC (Calculated Value) 20-3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3 IVAR (Integer Value) 20-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.4 SI (Scaled Integer) 20-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.5 FLAG (Flag) 20-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.6 DI10 (Digital Input Array of Size 10) 20-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.7 DO10 (Digital Output Array of Size 10) 20-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.8 TEXT (Text) 20-18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.9 UNIT (Unit) 20-20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.10 AREA (Area) 20-24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20-2 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
20.1 Understanding Elementary OSx Types
The function blocks in this chapter are designed to provide the fullfunctionality of the following OSx elementary tag types: CALC, IVAR,FLAG, DI10, DO10, TEXT, UNIT, and AREA.
Whenever you place a function block in CFC, a data block is used to storethe value of the function block as well as OSx alarm information.Unnecessary use of function blocks could cause you to exhaust the supply ofavailable data blocks on the controller and tie up alarm resources. To reducememory requirements on the controller, you can use symbols in place offunction blocks for tags that do not require alarm messaging. For example,if a limit switch does not require alarming, then you can use a symbolinstead of the DI function block.
For information on how to create a symbol in the symbol table, see thechapter on Configuring and Installing S7 Tags in the SIMATIC PCS 7 OSxInterface to S7 Controllers Manual.
20-3SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
20.2 CALC (Calculated Value)
Use the CALC function block (FB402) only when you want to have anunassociated real value known to OSx.
Connect your process output to the block input IN. An output called OUT hasbeen placed on the block interface so that you can connect the block to afield device or use it as an input to other objects. During block operation, thevalue of IN is copied to OUT. Be aware that if this object is called from one ofthe longer cyclic interrupt OBs, signal propagation from IN to OUT could bedelayed. Set the H_RANGE and L_RANGE inputs to the range of the processoutput. These inputs have no effect on the operation of the function block;they are used for out-of-range checking on the OSx station.
An extra input is available on this block, the STATUS input. STATUS is aword input and is used as a trigger to send an exception to OSx if the statusattribute has been configured for autologging in the Comment field of theOperator Control and Monitoring dialog box. A single exception is sent eachtime the most significant bit of STATUS changes.
For example, you can use STATUS to monitor the value that you are feedinginto the IN input on the CALC function block and set STATUS to W#16#8000if that value exceeds a certain range. STATUS is not modified automaticallyby the CALC block; you must supply the necessary logic to trigger theexception.
An OSx deadband is used to specify the change (in percent of span) in theinput value required for OSx to update the value in the database. Thedeadband is automatically set to a default of 1.0%. You can change thedeadband value in the Comment field of the Operator Control & Monitoringdialog box by entering CHANGE=<n>, where n is the new deadband valuebetween 0.0 and 100.0. Set this deadband value to filter out noise in theinput signal. This value is used only to provide a setting for the OSx system.The CALC function block does not use this value for any calculation.
Configure engineering units for the value of the CALC block in theComment field of the Operator Control and Monitoring window. Seepage 1-26.
When you use a CALC block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
20-4 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
CALC (continued)
The CALC function block is shown in Figure 20-1, and its inputs andoutputs are described in Table 20-1 and Table 20-2.
OB351
BO EN
calc_17
CALC
ENO BO1
Calculate tag
OUT R
16#0
100.0
0.0
W STATUS
R H_RANGE
R L_RANGE
R IN0.0
Figure 20-1 CALC Block
The CALC Block
20-5SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
Table 20-1 Input Table for CALC
Element Description Type InitialValue
EN Enable BOOL 1
H_RANGE High range attribute REAL 100.0
L_RANGE Low range attribute REAL 0.0
STATUS Packed STATUS bits WORD 16#0
IN Input REAL 0.0
Table 20-2 Output Table for CALC
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output REAL 0.0
20-6 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
20.3 IVAR (Integer Value)
Use the IVAR function block (FB403) only when you want to have an integervalue known to OSx.
Connect your process output to the block input IN. An output called OUT hasbeen placed on the block interface so that you can connect the block to afield device or use it as an input to other objects. During block operation, thevalue of IN is copied to OUT. Be aware that if this object is called from one ofthe longer cyclic interrupt OBs, signal propagation could be delayed.
An extra input is available on this block, the STATUS input. STATUS is aword input and is used as a trigger to send an exception to OSx if the statusattribute has been configured for autologging in the Comment field of theOperator Control and Monitoring dialog box. A single exception is sent eachtime the most significant bit of STATUS changes.
For example, you can use STATUS to monitor the value that you are feedinginto the IN input on the IVAR function block and set STATUS to W#16#8000if that value exceeds a certain range. STATUS is not modified automaticallyby the IVAR block; you must supply the necessary logic to trigger theexception.
NOTE: Whenever you place an IVAR function block in CFC, a data block isused to store the value of the IVAR as well as OSx alarming information.Overuse of the IVAR block could cause you to exhaust the supply ofavailable data blocks on the controller and tie up S7 message resources.
The H_RANGE and L_RANGE limits for OSx are automatically set to defaultsof 32000 and 0, respectively. You can change these values in the Commentfield of the Operator Control & Monitoring dialog box by enteringH_RANGE=<n> or L_RANGE=<n>, where n is the new value for that limit.The IVAR function block does not use these values for any calculation.
Configure engineering units for the value of the IVAR block in the Commentfield of the Operator Control and Monitoring window. See page 1-26.
When you use an IVAR block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
20-7SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
The IVAR function block is shown in Figure 20-2, and its inputs and outputsare described in Table 20-3 and Table 20-4.
OB351
BO EN
ivar_20
IVAR
ENO BO1
Integer variab
OUT I16#0 W STATUS
I IN0
Figure 20-2 IVAR Block
Table 20-3 Input Table for IVAR
Element Description Type InitialValue
EN Enable BOOL 1
STATUS Packed STATUS bits WORD 16#0
IN Input INT 0
Table 20-4 Output Table for IVAR
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output INT 0
The IVAR Block
20-8 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
20.4 SI (Scaled Integer)
The SI function block (FB411) takes an integer input and translates it toOSx as an analog output. OSx then scales the integer to a real number,using the high and low ranges. The high range, low range, and engineeringunits are also sent to OSx. In the S7 controller, the value remains aninteger.
You can write directly to the IN input in the controller program or use theINC or DEC input to change the value. Set the INC input to true (1) toincrement the value by one; set the DEC input to true (1) to decrement thevalue by one. These inputs are automatically reset to false (0) when theblo c k e x e cu te s. Fig u re 20- 3 sh o w s h o w to u se th e INC input to increment theinput value.
MODE is available for OSx to command the SI. You must supply allnecessary logic for MODE.
CFC2.SI_1.OUT>100
\\ increment SI_1CFC2.SI_1.INC := TRUES1
T1
Figure 20-3 Using Scaled Integers in SFC Steps
When you use an SI block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
20-9SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
The SI function block is shown in Figure 20-4, and its inputs and outputsare described in Table 20-5 and Table 20-6.
OB351
BO EN
SI_1
SI
ENO BO1
Scaled Integer
OUT I
0
100.0
0.0
I IN
R H_RANGE
R L_RANGE
BO INC0
BO DEC0
MODE W
Figure 20-4 SI Block
Table 20-5 Input Table for SI
Element Description Type InitialValue
EN Enable BOOL 1
H_RANGE High range of output in engineering units REAL 100.0
L_RANGE Low range of output in engineering units REAL 0.0
IN Integer between --32768 and 32767 INT 0
INC Increment input value BOOL 0
DEC Decrement input value BOOL 0
Table 20-6 Output Table for SI
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output INT 0
MODE OSx mode commands WORD 16#0
The SI Block
20-10 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
20.5 FLAG (Flag)
The FLAG function block (FB436) allows you to mark an event in thecontroller program. The FLAG output can be read anywhere in the program.You set the FLAG output with the following command inputs:
• LATCH — The OUT output is latched to true and remains true untilcleared.
• CLEAR — The OUT output is set to false.
• ON — The OUT output is set to true for exactly one execution period.The next time the FLAG block executes, the OUT output is set to false.
For safety reasons, the CLEAR input always has priority over the other twocommand inputs, and LATCH always has priority over the ON input.
You can set the FLAG block to retentive by setting the RETENTIVE input to1. When the FLAG block is retentive, the block retains its last state uponreturn from power failure.
The FLAG block has RBE capability and maps into OSx as a DI tag.
When you use an FLAG block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
• RD_SINFO (SFC6)
Overview
Required Blocks
20-11SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
The FLAG function block is shown in Figure 20-5, and its inputs andoutputs are described in Table 20-7 and Table 20-8.
1
0
FL_1
FLAGFlag object OB35
1
ENO BOBO EN
0
0
BO ON
BO RETENTIV
0 BO LATCH
BO CLEAR
OUT BO
Figure 20-5 FLAG Block
Table 20-7 Input Table for FLAG
Element Description Type InitialValue
EN Enable BOOL 1
LATCH Latch the OUT output to 1 until cleared BOOL 0
CLEAR Set the OUT output to 0 BOOL 0
ON Set the OUT output to 1 for one execution BOOL 0
RETENTIVE Retain flag status after powerfail BOOL 0
Table 20-8 Output Table for FLAG
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT Output BOOL 0
The FLAG Block
20-12 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
20.6 DI10 (Digital Input Array of Size 10)
The DI10 function block (FB400) is a Boolean array with a length of tenthat is translated to OSx as a DI10 tag type.
Use the DI10 function block only when you want to have multiple digitalinputs or Booleans signal an event to OSx, such as the activation of pushbuttons or switches. A message is sent each time the inputs change if theblock is configured for alarming or autologging in OSx.
Connect the digital inputs to the block inputs IN1 through IN10. Ten outputsnamed OUT1 through OUT10 have been placed on the block interface so thatyou can connect the inputs to other objects. During block operation, thevalue of INx is copied to OUTx. Be aware that if this object is called from oneof the longer cyclic interrupt OBs, signal propagation could be delayed.
NOTE: Whenever you place a DI10 function block in CFC, a data block isused to store the status of the DI10 as well as OSx alarming information.Overuse of the DI10 block could cause you to exhaust the supply of availabledata blocks on the controller and tie up S7 message resources.
When you use a DI10 block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
• PACKSTAT (FC930)
Overview
Required Blocks
20-13SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
The DI10 function block is shown in Figure 20-6, and its inputs and outputsare described in Table 20-9 and Table 20-10.
OB351
BO EN
di10_7
DI10
ENO BO1
Digital input
OUT1 BO0
0
0
BO IN1
BO IN2
BO IN40
BO IN3
0
0
0
0
W STATUS
BO IN7
BO IN90
BO IN8
0
BO IN5
BO IN6
BO IN10
OUT2 BO
OUT3 BO
OUT4 BO
OUT5 BO
OUT6 BO
OUT8 BO
OUT9 BO
OUT10 BO
OUT7 BO
Figure 20-6 DI10 Block
The DI10 Block
20-14 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
DI10 (continued)
Table 20-9 Input Table for DI10
Element Description Type InitialValue
EN Enable BOOL 1
IN1 Input 1 BOOL 0
IN2 Input 2 BOOL 0
IN3 Input 3 BOOL 0
IN4 Input 4 BOOL 0
IN5 Input 5 BOOL 0
IN6 Input 6 BOOL 0
IN7 Input 7 BOOL 0
IN8 Input 8 BOOL 0
IN9 Input 9 BOOL 0
IN10 Input 10 BOOL 0
Table 20-10 Output Table for DI10
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT1 Output 1 BOOL 0
OUT2 Output 2 BOOL 0
OUT3 Output 3 BOOL 0
OUT4 Output 4 BOOL 0
OUT5 Output 5 BOOL 0
OUT6 Output 6 BOOL 0
OUT7 Output 7 BOOL 0
OUT8 Output 8 BOOL 0
OUT9 Output 9 BOOL 0
OUT10 Output 10 BOOL 0
20-15SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
20.7 DO10 (Digital Output Array of Size 10)
The DO10 function block (FB401) is a Boolean array with a length of tenthat is translated to OSx as a DO10 tag type.
Use the DO10 function block only when you want to have multiple digitaloutputs or Booleans signal an event to OSx, such as the commanding of fielddevices or the illumination of panel lamps. A message is sent each time theinputs change if the block is configured for alarming or autologging in OSx.
Connect the process outputs to the block inputs IN1 through IN10. Tenoutputs named OUT1 through OUT10 have been placed on the block interfaceso that you can connect the block to field devices or use them as inputs toother objects. During block operation, the value of INx is copied to OUTx. Beaware that if this object is called from one of the longer cyclic interrupt OBs,signal propagation could be delayed.
NOTE: Whenever you place a DO10 function block in CFC, a data block isused to store the status of the DO10 as well as OSx alarming information.Overuse of the DO10 block could cause you to exhaust the supply ofavailable data blocks on the controller and tie up S7 message resources.
When you use a DO10 block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
• PACKSTAT (FC930)
Overview
Required Blocks
20-16 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
DO10 (continued)
The DO10 function block is shown in Figure 20-7, and its inputs andoutputs are described in Table 20-11 and Table 20-12.
OB351
BO EN
do10_4
DO10
ENO BO1
Digital output
OUT1 BO0
0
0
BO IN1
BO IN2
BO IN40
BO IN3
0
0
0
0
W STATUS
BO IN7
BO IN90
BO IN8
0
BO IN5
BO IN6
BO IN10
OUT2 BO
OUT3 BO
OUT4 BO
OUT5 BO
OUT6 BO
OUT8 BO
OUT9 BO
OUT10 BO
OUT7 BO
Figure 20-7 DO10 Block
The DO10 Block
20-17SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
Table 20-11 Input Table for DO10
Element Description Type InitialValue
EN Enable BOOL 1
IN1 Input 1 BOOL 0
IN2 Input 2 BOOL 0
IN3 Input 3 BOOL 0
IN4 Input 4 BOOL 0
IN5 Input 5 BOOL 0
IN6 Input 6 BOOL 0
IN7 Input 7 BOOL 0
IN8 Input 8 BOOL 0
IN9 Input 9 BOOL 0
IN10 Input 10 BOOL 0
Table 20-12 Output Table for DO10
Element Description Type InitialValue
ENO Output valid BOOL 0
OUT1 Output 1 BOOL 0
OUT2 Output 2 BOOL 0
OUT3 Output 3 BOOL 0
OUT4 Output 4 BOOL 0
OUT5 Output 5 BOOL 0
OUT6 Output 6 BOOL 0
OUT7 Output 7 BOOL 0
OUT8 Output 8 BOOL 0
OUT9 Output 9 BOOL 0
OUT10 Output 10 BOOL 0
20-18 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
20.8 TEXT (Text)
The TEXT function block (FB407) allows your program to exchange textualinformation easily with OSx. Connect the process output to one of the blockinputs: TEXT_1, TEXT_2, or TEXT_3. Each input is a string of up to 30characters. These text inputs can be read from and written to by OSx. Beaware that if both your process and OSx are writing to an input at the sametime, data can be lost.
The block outputs TEXT_1_O, TEXT_2_O, and TEXT_3_O allow the valueswritten by OSx to be used by your process. These outputs have a one-to-onecorrespondence to the inputs.
To assign text to a text string, you must enter the text in the Comment fieldof the Operator Control and Monitoring window, as shown below:
text_n=<string[30]>
where n is either 1, 2, or 3 corresponding to the TEXT_1, TEXT_2, or TEXT_3attributes.
For example, to have TEXT_2 initially set to BATCH WAITING TO BESTARTED, you enter text_2=’BATCH WAITING TO BE STARTED’ in theComment field. Always enclose the text string in single quotes.
NOTE: Whenever you place a TEXT function block in CFC, a data block isused to store the status of the text string as well as OSx process groupinformation. Overuse of the TEXT block could cause you to exhaust thesupply of available data blocks on the controller.
Overview
20-19SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
The TEXT function block is shown in Figure 20-8, and its inputs andoutputs are described in Table 20-13 and Table 20-14.
OB351
BO EN
txt_10
TEXT
ENO BO1
Text tag
TEXT _1_O SN* *
* *
* *
SN TEXT_1
SN TEXT_2
SN TEXT_3
TEXT _2_O SN
TEXT_3_O SN
Figure 20-8 TEXT Block
Table 20-13 Input Table for TEXT
Element Description Type InitialValue
EN Enable BOOL 1
TEXT_1 First text string STRING (30) * *
TEXT_2 Second text string STRING (30) * *
TEXT_3 Third text string STRING (30) * *
Table 20-14 Output Table for TEXT
Element Description Type InitialValue
ENO Output valid BOOL 0
TEXT_1_O First text string STRING (30) * *
TEXT_2_O Second text string STRING (30) * *
TEXT_3_O Third text string STRING (30) * *
The TEXT Block
20-20 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
20.9 UNIT (Unit)
The UNIT function block (FB405) allows the controller to retain the batchcontrol, but allows OSx to assist in batch tracking/reports, by means ofthree inputs. See Table 20-15 for the BCH_REQ, BCH_REQ_RESP, andBCH_REQ_INFO inputs.
The controller program can set these inputs as needed to perform theappropriate connections between the control node and the OSx station. OSxuses its database to log batch changes and to create batch reports. Makingbatch requests in the controller by way of BCH_REQ allows OSx to notify itsdatabase of the actions taking place in the controller and keep appropriaterecords of what is happening during the batch. The BCH_REQ inputs thenumerical equivalents of the commands for the batches. These numbers arelisted in the SIMATIC PCS 7 OSx Batch Programming Manual.
Table 20-15 Batch Unit Tag I/O
Inputs Description Values
BCH_REQ batch request word value (16#0000--16#FFFF)
BCH_REQ_RESP batch requestresponse
SUCCESSFUL_TRANSFER (8000H)FAILED_TRANSFER (4000H)NO_COMMAND (0000H)
BCH_REQ_INFO batch requestinformation up to 16 characters
Each time the BCH_REQ is sent to a batch or unit command, the OSx batchmanager processes the command and then writes successful (8000H) orfailed (4000H) to the BCH_REQ_RESP I/O. A value of 8000H (successful)does not mean that the requested command was actually successfullyexecuted; it means that the batch manager successfully read the requestand passed it along to the batch and/or unit. Typically, the controller setsBCH_REQ_RESP to no command (0000H) before a batch request.
If you need to send additional information along with the BCH_REQ, you canenter up to 16 characters in BCH_REQ_INFO.
When you use a UNIT block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
Overview
Required Blocks
20-21SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
The controller program can set block inputs as needed to perform theappropriate connections between the control node and the OSx station. OSxuses its database to log batch changes and to create batch reports. Makingbatch requests in the controller by way of the BCH_REQ input allows OSx tonotify its database of the actions taking place in the controller and keeprecords of what is happening during the batch. The BCH_REQ_INFO input isa variable used to provide more information that may be required toperform the batch request being made. Typically, the controller setsBCH_REQ_RESP to NO_COMMAND (0000H) before a batch request.
The BCH_REQ input can be set to valid batch and unit commands. Refer tothe SIMATIC PCS 7 OSx Batch Programming Manual for batch requestcommands.
Each time the BCH_REQ input is set to a batch or unit command, the OSxbatch manager processes the command and then writes successful (0x8000)or failed (0x4000) to the BCH_REQ_RESP input of the unit that made therequest. Note that a value of successful does not mean that the requestedcommand was actually successfully executed; it merely means that thebatch manager successfully read the request and has passed it along to thebatch and/or unit.
How Does theController ProgramWork?
Batch RequestCommands
Batch RequestResponse
20-22 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
UNIT (continued)
The UNIT function block is shown in Figure 20-9, and its inputs andoutputs are described in Table 20-16 and Table 20-17. Note that the fullnames of the inputs and outputs are not visible on the function block. Referto the tables to distinguish among them.
OB351
BO EN
unit_3
UNIT
ENO BO1
Unit tag
BCH_REQ_ W16#0
’ ’
’ ’
W BCH_REQ
SN BCH_REQ_
W BCH_REQ_16#0
SN OPERATIO
W STATUS16#0
OPERATIO SN
MODE_CMD W
COMMAND W
BCH_REQ_ SN
Figure 20-9 UNIT Block
The UNIT Block
20-23SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
Table 20-16 Input Table for UNIT
Element Description Type Initial Value
EN Enable BOOL 1
BCH_REQ Batch request WORD 16#0
BCH_REQ_INFO Batch request information STRING (16) ’ ’
OPERATION Operation STRING (10) ’ ’
BCH_REQ_RESP Batch request response WORD 16#0
STATUS Packed STATUS bits WORD 16#0
Table 20-17 Output Table for UNIT
Element Description Type Initial Value
ENO Output valid BOOL 0
BCH_REQ_RESP_O Batch request response output WORD 16#0
BCH_REQ_INFO_O Batch request information STRING (16) ’ ’
OPERATION_O Operation output STRING (10) ’ ’
MODE_CMD Mode command (from OSx) WORD 16#0
COMMAND Command (from OSx) WORD 16#0
20-24 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
20.10 AREA (Area)
The AREA function block (FB404) is used in downloading recipes from OSx.The following I/O are designed to work with the OSx recipe package tocoordinate handshaking and recipe download from OSx to the controller:
• The INUSE input indicates when the recipe is available. OSx can onlydownload a recipe when the recipe is not in use. You can use a DO tagto control the INUSE input. See page 20-25 for the configuration.
• The DSTBL input is set to true (1) when a recipe has been successfullydownloaded.
• The recipe data is ready when the DRDY output is true. This output isset to true only when the INUSE and DSTBL inputs are both true. SeeFigure 20-10.
The AREA function block generates an alarm for OSx whenever the value ofeither INUSE or DSTBL changes.
You can use SCALE_O with external logic to rescale the values in yourrecipe.
INUSE
DSTBL
DRDY
Clear Recipe
OSx candownloadrecipe
Recipe data isdownloading tocontroller fromOSx
Select RecipeOSx processinginitiates recipedownload
Processingrecipe
Clear RecipeDRDY is true whendownload is complete
Select new recipeOSx initiates newrecipe
Second downloadis complete
Figure 20-10 Recipe Download Coordination
Overview
20-25SIMATIC PCS 7 OSx 4.1.2 Library Elementary OSx Types
The SCALE_HIGH and SCALE_LOW limits for OSx are automatically set todefaults of 100.0 and 0.0, respectively. You can change these values in theComment field of the Operator Control & Monitoring dialog box by enteringSCALE_HIGH=<n> or SCALE_LOW=<n>, where n is the new value for thatlimit. The AREA function block does not use these values for anycalculation.
The INUSE input automatically defaults to <AREA tag name>.inu. You canchange this value in the Comment field of the Operator Control &Monitoring dialog box by entering INU=<tagname>, where tagname is thename of the DO tag that controls the INUSE input.
When you use an AREA block, the following function blocks must also bepresent in the Blocks folder of your S7 program:
• RBE_S (FB395)
• ALARM_S (SFC18)
• PACKSTAT (FC930)
The AREA function block is shown in Figure 20-11, and its inputs andoutputs are described in Table 20-18 and Table 20-19.
OB351
BO EN
area_7
AREA
ENO BO1
DRDY BO0 BO INUSE
BO DSTBL0
BO HOLDREQ0
Area tag
HOLDREQ_ BO
SCALE_O R
W RECREQ16#FFFE
R SCALE1.0
Figure 20-11 AREA Block
Required Blocks
The AREA Block
20-26 SIMATIC PCS 7 OSx 4.1.2 LibraryElementary OSx Types
AREA (continued)
Table 20-18 Input Table for AREA
Element Description Type InitialValue
EN Enable BOOL 1
INUSE Recipe in use BOOL 0
DSTBL Data is stable BOOL 0
HOLDREQ Hold request BOOL 0
RECREQ Recipe request WORD 16#FFFE
SCALE Recipe scale factor REAL 1.0
Table 20-19 Output Table for AREA
Element Description Type InitialValue
ENO Output valid BOOL 0
DRDY Download complete BOOL 0
HOLDREQ_O Hold request output BOOL 0
SCALE_O Scale output REAL 1.0
Index-1SIMATIC PCS 7 OSx 4.1.2 Library
Index
AABS_MTH (FC900), 14-3
Absolute value (ABS_MTH), 14-3
ADAPTER (FB393), 1-12
Advanced control blockdead time compensator, 5-3dual mode (DMD), 5-10feedforward output adjust (FFOA), 5-20feedforward setpoint adjust (FFSA), 5-27ratio station (RATIO), 5-35
AI (FB440), 2-3
ALARM_8P (SFB35), 1-12
ALARM_S (SFC18), 1-12
ALRM (FB384), 3-41associated math, 3-46
Analog alarm (ALRM), 3-41
Analog inputI/O type, 2-3scaling, 2-3
Analog intput (AI), 2-3
Analog output (AO), 2-8
Anti--reset windup protection/constraint type(ARWPC), 6-3
Anti--reset windup protection/select type(ARWPS), 6-8
AO (FB406), 2-8
Area (AREA), 20-24
AREA (FB404), 20-24
Array blockssequence array (SEQ_ARY), 19-2shift register array (SR_ARY), 19-6text array (TA), 19-9
ARWPC (FB427), 6-3
ARWPS (FB428), 6-8
Assigning, function blocks to process groups,1-29
Associated mathALRM block, 3-46DMD block, 5-18, 5-34ONOFF block, 3-37PID block, 3-22
Attribute, high/low range, 1-28
Autolog, function block, 1-27
Average selector (AVG_SEL), 18-3
AVG_SEL (FB375), 18-3
BBCD input (BI), 2-34
BCD Output (BO), 2-36
BCD to binary conversion (BCDBIN), 15-2
BCDBIN (FB409), 15-2
BI (FB432), 2-34
Bias feeze, PID, 3-20
Binary to BCD conversion (BINBCD), 15-4
BINBCD (FB410), 15-4
Bipolar, scaling, 2-3
Bit assign (BIT_ASGN), 15-6
Bit clear (BITCLEAR), 15-8
Bit set (BITSET), 15-10
Bit test (BITTEST), 15-12
BIT_ASGN (FC912), 15-6
BITCLEAR (FC913), 15-8
Bits to integer (BITS_INT), 16-3
BITS_INT (FC915), 16-3
BITSET (FC914), 15-10
BITTEST (FC916), 15-12
Index-2 SIMATIC PCS 7 OSx 4.1.2 Library
Block Object Properties, I/O folder, 1-30
BO (FB433), 2-36
BV1 (FB351), 8-31
BV2 (FB352), 8-36
CCALC (FB402), 20-3
Calculated value (CALC), 20-3
CFC, illustration, 1-3
CHANGE attribute, 1-26
Comment field, operator control andmonitoring, 1-26
Configuringautolog, function block, 1-27CHANGE attribute (deadband), 1-26engineering units, function block, 1-27high range, function block, 1-28initial valuefor networked attributes, 1-30, 1-32in Block Object Properties, 1-30in WinCC attributes, 1-32
low range, function block, 1-28manual set, function block, 1-27non--networked attributes, 1-28parent unit, function block, 1-27process groups, function block, 1-29tag description, function block, 1-26upload, function block, 1-27
CORLT (FB439), 6-13
Correlated lookup table (CORLT), 6-13
Counter (CT_DECL), 13-2
CSD (FB371), 11-4
CT_DECL (FB340), 13-2
CUD (FB372), 11-9
Cylinder, device type, 7-4
Cylinder blockssingle-drive/dual-feedback (CSD), 11-4user-defined (CUD), 11-9
DDead time compensator control block,
input/output control, 5-3
Dead time delay (DTD), 4-19
Deadband, function block, 1-26
Derivative (DERV), 4-22
DERV (FB421), 4-22
Description, function block, 1-26
Deviceauto mode, 7-2, 7-9changing mode, 7-10changing state, 7-11defined, 7-2dual feedback, 7-16fail bit, 7-14, 7-17feedback override, 7-12manual mode, 7-2, 7-8null feedback, 7-13position bit, 7-14power fail recovery, 7-21reset command, 7-12single feedback, 7-14state bit, 7-14stopwatch, three--state (TMR), 13-8timer, three--state (TMR), 13-8types, 7-4
DI (FB398), 2-26
DI10 (FB400), 20-12
Digital input (DI), 2-26
Digital input, size 10 (DI10), 20-12
Digital output (DO), 2-28
Digital output, size 10 (DO10), 20-15
DISABL input, 1-12
Disabling, function blocks, 1-12
DIV_MTH (FC901), 14-4
Divider (DIV_MTH), 14-4
DMD (FB414), 5-10associated math, 5-18, 5-34
DO (FB399), 2-28
Index-3SIMATIC PCS 7 OSx 4.1.2 Library
DO10 (FB401), 20-15
DTD (FB420), 4-19
Dual mode, associated math, 5-18, 5-34
Dual mode (FM414), 5-10
Dual mode control block, 5-10enabling/disabling, 5-12
Dual-drive/dual-feedback press (PDD), 12-19
Dual-drive/dual-feedback valve (VDD), 8-19
Dual-drive/null-feedback motor (MDN), 10-11
Dual-drive/single-feedback motor (MDS), 10-14
Dynamic blocksdead time delay (DTD), 4-19derivative (DERV), 4-22first order lag (FOLAG), 4-6first order lead lag (FOLL), 4-9integrator (INTEG), 4-25second order lag (SOLAG), 4-13second order lead lag (SOLL), 4-16
Dynamic control blockinitialization, 4-3simulation equations, 4-5
EEdge (EDGE), 15-14
EDGE (FB388), 15-14
ENABL input, 1-12
Enabling, function blocks, 1-12
Engineering units, function block, 1-27
FFail bit for devices, 7-14, 7-17
FB340 (CT_DECL), 13-2
FB341 (TI_DECL), 13-4
FB342 (SEQ_ARY), 19-2
FB343 (SR_ARY), 19-6
FB344 (VSS), 8-10
FB345 (VSD), 8-14
FB346 (VND), 8-5
FB347 (VSN), 8-7
FB348 (VDD), 8-19
FB349 (VMD), 8-23
FB350 (VUD), 8-27
FB351 (BV1), 8-31
FB352 (BV2), 8-36
FB353 (PSS), 12-10
FB354 (PSD), 12-14
FB355 (PND), 12-5
FB356 (PSN), 12-7
FB357 (PDD), 12-19
FB358 (PMD), 12-23
FB359 (PUD), 12-27
FB360 (PS1), 12-31
FB361 (PS2), 12-36
FB362 (MSN), 10-5
FB363 (MSS), 10-8
FB364 (MDN), 10-11
FB365 (MDS), 10-14
FB366 (RM1), 10-22
FB367 (RM2), 10-27
FB368 (TS1), 10-32
FB369 (TS2), 10-37
FB370 (MUD), 10-18
FB371 (CSD), 11-4
FB372 (CUD), 11-9
FB373 (OUT_LIM), 17-2
FB374 (RATE_LIM), 17-4
FB375 (AVG_SEL), 18-3
FB376 (HIGH_SEL), 18-6
Index-4 SIMATIC PCS 7 OSx 4.1.2 Library
FB377 (ISWT_SEL), 18-9
FB378 (LOW_SEL), 18-11
FB379 (MED_SEL), 18-14
FB380 (OSWT_SEL), 18-16
FB381 (THR_SEL), 18-18
FB382 (PID), 3-3
FB383 (ONOFF), 3-28
FB384 (ALRM), 3-41
FB385 (PTC), 9-6
FB386 (SPL_RNG), 9-8
FB387 (SCL_BLK), 15-33
FB388 (EDGE), 15-14
FB389 (LEAD_LAG), 15-16
FB390 (MAX), 15-23
FB391 (MIN), 15-25
FB392 (MINMAX), 15-27
FB398 (DI), 2-26
FB399 (DO), 2-28
FB400 (DI10), 20-12
FB401 (DO10), 20-15
FB402 (CALC), 20-3
FB403 (IVAR), 20-6
FB404 (AREA), 20-24
FB405 (UNIT), 20-20
FB406 (AO), 2-8
FB407 (TEXT), 20-18
FB409 (BCDBIN), 15-2
FB410 (BINBCD), 15-4
FB411 (SI), 20-8
FB412 (TA), 19-9
FB414 (DMD), 5-10
FB415 (FFOA), 5-20
FB416 (FFSA), 5-27
FB417 (RATIO), 5-35
FB418 (MPC), 9-2
FB419 (VLV_SEQ), 9-11
FB420 (DTD), 4-19
FB421 (DERV), 4-22
FB422 (INTEG), 4-25
FB423 (FOLAG), 4-6
FB424 (FOLL), 4-9
FB424 (SOLL), 4-16
FB425 (SOLAG), 4-13
FB427 (ARWPC), 6-3
FB428 (ARWPS), 6-8
FB429 (TMR), 13-8
FB430 (WI), 2-30
FB431 (WO), 2-32
FB432 (BI), 2-34
FB433 (BO), 2-36
FB434 (RTD), 2-10
FB435 (TC), 2-18
FB436 (FLAG), 20-10
FB439 (CORLT), 6-13
FB440 (AI), 2-3
FC900 (ABS_MTH), 14-3
FC901 (DIV_MTH), 14-4
FC902 (MLT_MTH), 14-5
FC904 (SQR_MTH), 14-6
FC905 (SQRT_MTH), 14-7
FC906 (SUB_MTH), 14-8
FC907 (SUM_MTH), 14-9
FC912 (BIT_ASGN), 15-6
FC913 (BITCLEAR), 15-8
FC914 (BITSET), 15-10
FC915 (BITS_INT), 16-3
FC916 (BITTEST), 15-12
FC917 (FRAC), 15-15
Index-5SIMATIC PCS 7 OSx 4.1.2 Library
FC918 (INTERPOL), 16-6
FC919 (INT_BITS), 16-4
FC920 (LEFT_SH), 15-19
FC921 (LIMIT), 15-21
FC922 (LOAD_ARR), 16-8
FC923 (LOOKUP), 16-10
FC924 (PACKBITS), 16-12
FC926 (ROUND), 15-31
FC927 (TRUNC), 15-36
FC928 (RIGHT_SH), 15-29
FC929 (UNPKBIT), 16-13
FC931 (LOAD_IAR), 16-9
Feedback for devicesdual, 7-16null, 7-13override, 7-12single, 7-14
Feedforward output adjust (FM415), 5-20
Feedforward output adjust control block, outputcontrol, 5-20
Feedforward setpoint adjust (FM416), 5-27
Feedforward setpoint adjust control block,setpoint control, 5-27
FFOA (FB415), 5-20
FFSA (FB416), 5-27
First order lag (FOLAG), 4-6
First order lead lag (FOLL), 4-9
FLAG (FB436), 20-10
Flag output (FLAG), 20-10
FOLAG (FB423), 4-6
FOLL (FB424), 4-9
FRAC (FC917), 15-15
Fraction (FRAC), 15-15
Freeze bias, PID, 3-20
FTO output, 1-12
Function blocks (FBs)advancedDMD, 5-10FFOA, 5-20FFSA, 5-27RATIO, 5-35
analog intput (AI), 2-3analog output (AO), 2-8area (AREA), 20-24arraySEQ_ARY, 19-2SR_ARY, 19-6TA, 19-9
assigning, process groups, 1-29autolog, 1-27BCD input (BI), 2-34BCD output (BO), 2-36block numbers, 1-6calculated value (CALC), 20-3CHANGE attribute (deadband), 1-26counter (CT_DECL), 13-2cylinderCSD, 11-4CUD, 11-9
digital input (DI), 2-26digital input, size 10 (DI10), 20-12digital output (DO), 2-28digital output, size 10 (DO10), 20-15dynamicDERV, 4-22DTD, 4-19FOLAG, 4-6FOLL, 4-9INTEG, 4-25SOLAG, 4-13SOLL, 4-16
enabling/disabling, 1-12engineering units, 1-27flag output (FLAG)), 20-10high range, 1-28I/O labels, 1-13inputs and outputs used in SFC, 1-13integer value (IVAR), 20-6inverting I/O elements, 1-16invisible elements, 1-14limiterOUT_LIM, 17-2RATE_LIM, 17-4
Index-6 SIMATIC PCS 7 OSx 4.1.2 Library
Function blocks (FBs) (continued)low range, 1-28manual set, 1-27marking, 1-22mathEDGE, 15-14LEAD_LAG, 15-16MAX, 15-23MIN, 15-25MINMAX, 15-27SCL_BLK, 15-33
motorMDN, 10-11MDS, 10-14MSN, 10-5MSS, 10-8MUD, 10-18RM1, 10-22RM2, 10-27TS1, 10-32TS2, 10-37
naming conventions, 1-22non--networked attributes, 1-28OSx library, 1-2, 1-6OSx tag type, 1-11otherARWPC, 6-3ARWPS, 6-8CORLT, 6-13
parent unit, 1-27power--fail recovery, 1-18, 7-20pressPDD, 12-19PMD, 12-23PND, 12-5PS1, 12-31PS2, 12-36PSD, 12-14PSN, 12-7PSS, 12-10PUD, 12-27
required, 1-12resistive temperature detector (RTD), 2-10sample time, 1-13scaled integer (SI), 20-8
Function blocks (FBs) (continued)selectorAVG_SEL, 18-3HIGH_SEL, 18-6ISWT_SEL, 18-9LOW_SEL, 18-11MED_SEL, 18-14OSWT_SEL, 18-16THR_SEL, 18-18
standardALRM, 3-41ONOFF, 3-28PID, 3-3
stopwatch timer (TMR), 13-8tag description, 1-26tag types, 1-6text (TEXT), 20-18thermocouple (TC), 2-18timer (TI_DECL), 13-4unit (UNIT), 20-20upload, 1-27valveBV1, 8-31BV2, 8-36VDD, 8-19VMD, 8-23VND, 8-5VSD, 8-14VSN, 8-7VSS, 8-10VUD, 8-27
valve controlMPC, 9-2PTC, 9-6SPL_RNG, 9-8VLV_SEQ, 9-11
word input (WI), 2-30Word output (WO), 2-32
Functions (FCs)absolute value (ABS_MTH), 14-3BCD to binary conversion (BCDBIN), 15-2binary to BCD conversion (BINBCD), 15-4bit assign (BIT_ASGN), 15-6bit clear (BITCLEAR), 15-8bit set (BITSET), 15-10bit test (BITTEST), 15-12
Index-7SIMATIC PCS 7 OSx 4.1.2 Library
Functions (FCs) (continued)bits to integer (BITS_INT), 16-3divider (DIV_MTH), 14-4fraction (FRAC), 15-15integer to bits (INT_BITS), 16-4interpolate (INTERPOL), 16-6left shift (LEFT_SH), 15-19limiter (LIMIT), 15-21load integer array (LOAD_IAR), 16-9load real array (LOAD_ARR), 16-8lookup table (LOOKUP), 16-10multiplier (MLT_MTH), 14-5pack bits (PACKBITS), 16-12right shift (RIGHT_SH), 15-29round value (ROUND), 15-31square (SQR_MTH), 14-6square root (SQRT_MTH), 14-7subtractor (SUB_MTH), 14-8summer (SUM_MTH), 14-9truncate value (TRUNC), 15-36unpack bits (UNPKBIT), 16-13
HHand-operated/dual-feedback press (PND), 12-5
Hand-operated/dual-feedback valve (VND), 8-5
Hiding, function block elements, 1-14
High range, function block, 1-28
High selector (HIGH_SEL), 18-6
HIGH_SEL (FB376), 18-6
II/Ocontrol blocks, 2-2symbolic name typesanalog input (AI), 2-3resistance temperature input (RT), 2-10,
2-18
I/O elementsinverting, 1-16making invisible, 1-14
Initial valueconfiguringin Block Object Properties, 1-30in WinCC attributes, 1-32
used by CFC, 1-30used by OSx, 1-30
Inswitch selector (ISWT_SEL), 18-9
INT_BITS (FC919), 16-4
INTEG (FB422), 4-25
Integer to bits (INT_BITS), 16-4
Integer value (IVAR), 20-6
Integrator (INTEG), 4-25
Interlocks, 1-12
INTERPOL (FC918), 16-6
Interpolate (INTERPOL), 16-6
Inverting, I/O elements, 1-16
Invisible I/O, function blocks, 1-14
ISWT_SEL (FB377), 18-9
IVAR (FB403), 20-6
LLabels, I/O, function blocks, 1-13
Lead lag (LEAD_LAG), 15-16
LEAD_LAG (FB389), 15-16
Left shift (LEFT_SH), 15-19
LEFT_SH (FC920), 15-19
LIMIT (FC921), 15-21
Limiter (LIMIT), 15-21
Limiter blocksoutput limiter (OUT_LIM), 17-2rate limiter (RATE_LIM), 17-4
Load integer array (LOAD_IAR), 16-9
Load real array (LOAD_ARR), 16-8
LOAD_ARR (FC922), 16-8
LOAD_IAR (FC931), 16-9
Index-8 SIMATIC PCS 7 OSx 4.1.2 Library
LOOKUP (FC923), 16-10
Lookup table (LOOKUP), 16-10
Loopassociated math, 3-22freeze bias, 3-20status, 3-27
Loop control block (PID), 3-3
Low range, function block, 1-28
Low selector (LOW_SEL), 18-11
LOW_SEL (FB378), 18-11
MManual set, function block, 1-27
Marking, function block, 1-22
Math blocks (FBs)edge (EDGE), 15-14lead lag (LEAD_LAG), 15-16maximum value (MAX), 15-23minimum value (MIN), 15-25minimum/maximum value (MINMAX), 15-27scale (SCL_BLK), 15-33
Math functions (FCs)ABS_MTH, 14-3BCDBIN, 15-2BINBCD, 15-4BIT_ASGN, 15-6BITCLEAR, 15-8BITS_INT, 16-3BITSET, 15-10BITTEST, 15-12DIV_MTH, 14-4FRAC, 15-15INT_BITS, 16-4INTERPOL, 16-6LEFT_SH, 15-19LIMIT, 15-21LOAD_ARR, 16-8LOAD_IAR, 16-9LOOKUP, 16-10MLT_MTH, 14-5PACKBITS, 16-12RIGHT_SH, 15-29
Math functions (FCs) (continued)ROUND, 15-31SQR_MTH, 14-6SQRT_MTH, 14-7SUB_MTH, 14-8SUM_MTH, 14-9TRUNC, 15-36UNPKBIT, 16-13
MAX (FB390), 15-23
Maximum value (MAX), 15-23
MDN (FB364), 10-11
MDS (FB365), 10-14
MED_SEL (FB379), 18-14
Median selector (MED_SEL), 18-14
MIN (FB391), 15-25
Minimum value (MIN), 15-25
Minimum/maximum value (MINMAX), 15-27
MINMAX (FB392), 15-27
MLT_MTH (FC902), 14-5
Modes, devicesauto, 7-9changing, 7-10manual, 7-8
Motor, device type, 7-4
Motor blocksdual-drive/null-feedback (MDN), 10-11dual-drive/single-feedback (MDS), 10-14reversible/type 1 (RM1), 10-22reversible/type 2 (RM2), 10-27single-drive/null-feedback (MSN), 10-5single-drive/single-feedback (MSS), 10-8two-speed/type 1 (TS1), 10-32two-speed/type 2 (TS2), 10-37user-defined (MUD), 10-18
Motor position control (MPC), 9-2
Motor-drive/dual-feedback press (PMD), 12-23
Motor-drive/dual-feedback valve (VMD), 8-23
MPC (FB418), 9-2
MSN (FB362), 10-5
Index-9SIMATIC PCS 7 OSx 4.1.2 Library
MSS (FB363), 10-8
MUD (FB370), 10-18
Multiplier (MLT_MTH), 14-5
NNaming conventions, function block, 1-22
Networked attributes, initial valueused by CFC, 1-30used by OSx, 1-30, 1-32
Non--networked attributes, 1-28
NRDY input, 1-12
OOn/off (ONOFF), 3-28
ONOFF (FB383), 3-28associated math, 3-37
Operator Control and Monitoring, WinCCattributes folder, function block, 1-32
OSWT_SEL (FB380), 18-16
OSx function blocks (FBs)AI, 2-3AO, 2-8AREA, 20-24BI, 2-34BO, 2-36CALC, 20-3DI, 2-26DI10, 20-12DO, 2-28DO10, 20-15FLAG, 20-10IVAR, 20-6RTD, 2-10SI, 20-8TC, 2-18TEXT, 20-18UNIT, 20-20WI, 2-30WO, 2-32
OSx libraryfunction blocks, 1-2, 1-6tag types, 1-6
OSx tag types, 1-11
Other blocksanti--reset windup protection/constraint type
(ARWPC), 6-3anti--reset windup protection/select type
(ARWPS), 6-8correlated lookup table (CORLT), 6-13
Other control blocks, enabling/disabling, 4-2,6-2
OUT_LIM (FB373), 17-2
Output limiter (OUT_LIM), 17-2
Outswitch selector (OSWT_SEL), 18-16
Override device feedback, 7-12bits, 7-16
PPack bits (PACKBITS), 16-12
PACKBITS (FC924), 16-12
PACKSTAT (FC930), 1-12
Parameters, tag, setting, 1-26
Parent unit, function block, 1-27
PDD (FB357), 12-19
PID (FB382), 3-3associated math, 3-22freeze bias, 3-20
PMD (FB358), 12-23
PND (FB355), 12-5
Position bit for devices, 7-14
Power failuredevices, 7-21recovery logic, S7 controllers, 1-18, 7-20, 7-21
Press, device type, 7-4
Index-10 SIMATIC PCS 7 OSx 4.1.2 Library
Press blocksdual-drive/dual-feedback (PDD), 12-19hand-operated/dual-feedback (PND), 12-5motor-drive/dual-feedback (PMD), 12-23single-drive/dual-feedback (PSD), 12-14single-drive/null-feedback (PSN), 12-7single-drive/single-feedback (PSS), 12-10three-position/type 1 (PS1), 12-31three-position/type 2 (PS2), 12-36user-defined (PUD), 12-27
Process groupsassigning, function block, 1-29example, 1-29hex value, function block, 1-29
Proportional time control (PTC), 9-6
Proportional-integral-derivative loop (PID), 3-3
PS1 (FB360), 12-31
PS2 (FB361), 12-36
PSD (FB354), 12-14
PSN (FB356), 12-7
PSS (FB353), 12-10
PTC (FB385), 9-6
PUD (FB359), 12-27
RRate limiter (RATE_LIM), 17-4
RATE_LIM (FB374), 17-4
RATIO (FB417), 5-35
Ratio station (FM417), 5-35
Ratio station control block, 5-35
RBE_P (FB395), 1-12
RBE_S (FB395), 1-12
RD_SINFO (SFC6), 1-12
RDIS input, 1-12
REN input, 1-12
Required, function blocks, 1-12
Resistance temperature detector, I/O type, 2-10,2-18
Resistive Temperature Detector (RTD), 2-10
Reversible motor/type 1 (RM1), 10-22
Reversible motor/type 2 (RM2), 10-27
Right shift (RIGHT_SH), 15-29
RIGHT_SH (FC928), 15-29
RM1 (FB366), 10-22
RM2 (FB367), 10-27
ROUND (FC926), 15-31
Round value (ROUND), 15-31
RTD (FB434), 2-10
SS7 controllers, power failure, 1-18, 7-20
SAMPLE_T, 1-13
Scale (SCL_BLK), 15-33
Scaled Integer (SI), 20-8
Scaling, analog values, 2-3
SCL_BLK (FB387), 15-33
Second order lag (SOLAG), 4-13
Second order lead lag (SOLL), 4-16
Selector blocksaverage selector (AVG_SEL), 18-3high selector (HIGH_SEL), 18-6inswitch selector (ISWT_SEL), 18-9low selector (LOW_SEL), 18-11median selector (MED_SEL), 18-14outswitch selector (OSWT_SEL), 18-16threshold selector (THR_SEL), 18-18
SEQ_ARY (FB342), 19-2
Sequence array (SEQ_ARY), 19-2
Setting, tag parameters, 1-26
SFC, using block I/O, 1-13
Shift register array (SR_ARY), 19-6
Index-11SIMATIC PCS 7 OSx 4.1.2 Library
SI (FB411), 20-8
Single-drive/dual-feedback cylinder (CSD), 11-4
Single-drive/dual-feedback press (PSD), 12-14
Single-drive/dual-feedback valve (VSD), 8-14
Single-drive/null-feedback motor (MSN), 10-5
Single-drive/null-feedback press (PSN), 12-7
Single-drive/null-feedback valve (VSN), 8-7
Single-drive/single-feedback motor (MSS), 10-8
Single-drive/single-feedback press (PSS), 12-10
Single-drive/single-feedback valve (VSS), 8-10
SOLAG (FB425), 4-13
SOLL (FB426), 4-16
SPL_RNG (FB386), 9-8
Split range (SPL_RNG), 9-8
SQR_MTH (FC904), 14-6
SQRT_MTH (FC905), 14-7
Square (SQR_MTH), 14-6
Square root (SQRT_MTH), 14-7
SR_ARY (FB343), 19-6
Standard blocksanalog alarm (ALRM), 3-41on/off (ONOFF), 3-28proportional-integral-derivative (PID), 3-3
State, device, changing, 7-11
State bit for devices, 7-14
Stopwatch, three--state, 13-8
Stopwatch timer (TMR), 13-8
SUB_MTH (FC906), 14-8
Subtractor (SUB_MTH), 14-8
SUM_MTH (FC907), 14-9
Summer (SUM_MTH), 14-9
Symbol, text string, 20-18
TTA (FB412), 19-9
Tagnaming conventions, 1-22setting parameters, 1-26
Tag description, function block, 1-26
Tag parametersautolog, function block, 1-27change (deadband), 1-26engineering units, function block, 1-27high range, function block, 1-28low range, function block, 1-28manual set, function block, 1-27non--networked attributes, 1-28parent unit, function block, 1-27process groups, function block, 1-29tag description, function block, 1-26upload, function block, 1-27
Tag type, function blocks, 1-11
TC (FB435), 2-18
TEXT (FB407), 20-18
Text (TEXT), 20-18
Text array (TA), 19-9
Text string, symbol, 20-18
Thermocouple (TC), 2-18
THR_SEL (FB381), 18-18
Three-position press/type 1 (PS1), 12-31
Three-position press/type 2 (PS2), 12-36
Three-position valve/type 1 (BV1), 8-31
Three-position valve/type 2 (BV2), 8-36
Threshold selector (THR_SEL), 18-18
TI_DECL (FB341), 13-4
Timer, three--state, 13-8
Timer (stopwatch) (TMR), 13-8
Timer declaration (TI_DECL), 13-4
TMR (FB429), 13-8
Index-12 SIMATIC PCS 7 OSx 4.1.2 Library
TRUNC (FC927), 15-36
Truncate value (TRUNC), 15-36
TS1 (FB368), 10-32
TS2 (FB369), 10-37
Twenty percent offset, scaling, 2-3
Two-speed motor/type 1 (TS1), 10-32
Two-speed motor/type 2 (TS2), 10-37
UUNIT (FB405), 20-20
Unit (UNIT), 20-20
Unpack bits (UNPKBIT), 16-13
UNPKBIT (FC929), 16-13
Upload, function block, 1-27
User-defined cylinder (CUD), 11-9
User-defined motor (MUD), 10-18
User-defined press (PUD), 12-27
User-defined valve (VUD), 8-27
VValve, device type, 7-4
Valve blocksdual-drive/dual-feedback (VDD), 8-19hand-operated/dual-feedback (VND), 8-5motor-drive/dual-feedback (VMD), 8-23single-drive/null-feedback (VSN), 8-7single-drive/dual-feedback (VSD), 8-14single-drive/single-feedback (VSS), 8-10three-position/type 1 (BV1), 8-31three-position/type 2 (BV2), 8-36user-defined (VUD), 8-27
Valve control blocksmotor position control (MPC), 9-2proportional time control (PTC), 9-6split range (SPL_RNG), 9-8valve sequencer (VLV_SEQ), 9-11
Valve sequencer (VLV_SEQ), 9-11
VDD (FB348), 8-19
VLV_SEQ (FB419), 9-11
VMD (FB349), 8-23
VND (346), 8-5
VSD (FB345), 8-14
VSN (FB347), 8-7
VSS (FB344), 8-10
VUD (FB350), 8-27
WWI (FB430), 2-30
WinCC attributes, function block, 1-32
WO (FB431), 2-32
Word input (WI), 2-30
Word output (WO), 2-32
ZZero bias, scaling, 2-3
Customer Response
We would like to know what you think about our user manuals so that we can serve you better.How would you rate the quality of our manuals?
Excellent Good Fair Poor
AccuracyOrganizationClarityCompletenessGraphicsExamplesOverall designSizeIndex
Would you be interested in giving us more detailed comments about our manuals?
Yes! Please send me a questionnaire.
No. Thanks anyway.
Your Name:
Title:
Telephone Number: ( )
Company Name:
Company Address:
Manual Name: SIMATIC PCS 7 OSx Library for S7-400 Controllers Manual Edition: Original
Man u al A ssemb l y N u m b er: 2811165 -- 0001 Date: 7/02
Order Number: 6ES7 6530XX048BA0
BUSINESS REPLY MAILFIRST CLASS PERMIT NO.3 JOHNSON CITY, TN
FOLD
FOLD
POSTAGE WILL BE PAID BY ADDRESSEE
NO POSTAGENECESSARYIF MAILEDIN THE
UNITED STATES
ATTN TECHNICAL COMMUNICATIONS M/S 519SIEMENS ENERGY & AUTOMATION INCP O BOX 1255JOHNSON CITY TN 37605--1255
SIEMENS ENERGY & AUTOMATION INC3000 BILL GARLAND ROADP O BOX 1255JOHNSON CITY TN 37605--1255