DSO3D12 Modular and Scalable Control Systems
“
Informazione di u produttu
Specificazioni:
- Product Title: Object-Oriented PLC Programming in CODESYS
- Author: Majid Pakdel
- Publisher: Elektor Publication
- ISBN: 978-3-89576-696-1 (Print), 978-3-89576-697-8 (eBook)
Istruzzioni per l'usu di u produttu:
Chapter 1: Introduction to Object-Oriented PLC Programming
Begin by understanding the fundamentals of Object-Oriented PLC
Programming in CODESYS. Familiarize yourself with the concepts and
principles outlined in the book.
Chapter 2: Modular and Scalable Control Systems
Learn how to implement modular and scalable control systems
using structured text in CODESYS. Follow the step-by-step guide
provided in the book to create efficient control systems.
Chapter 3: Hands-On Practice
Apply the knowledge gained from the book by engaging in hands-on
practice. Experiment with different programming techniques and test
your understanding of Object-Oriented PLC Programming.
Domande Frequenti (FAQ):
Q: Is prior programming experience required to benefit from
this book?
A: While prior programming experience can be helpful, the book
is designed to cater to both beginners and experienced programmers.
It provides a comprehensive guide suitable for individuals at
various skill levels.
Q: Can this book be used for self-study purposes?
A: Yes, this book is structured to facilitate self-study. The
chapters are organized in a logical sequence, allowing readers to
progress at their own pace and reinforce their learning through
practical examples.
Q: Are there any online resources available to complement the
content of this book?
A: Yes, Elektor offers additional online resources and support
related to Object-Oriented PLC Programming with CODESYS. Visit
www.elektormagazine.com for supplementary materials and
aghjurnamenti.
"'
Object-Oriented PLC Programming
in CODESYS
Modular and Scalable Control Systems Using Structured Text
Academy Pro Title by
Majid Pakdel
Object-Oriented PLC Programming with CODESYS
Majid Pakdel
Object-Oriented PLC Programming with CODESYS
Questa hè una Publicazione Elektor. Elektor hè a marca media di
Elektor International Media BV PO Box 11, NL-6114-ZG Susteren, Paesi Bassi Telefono: +31 46 4389444
All rights reserved. No part of this book may be reproduced in any material form, including
photocopying, or storing in any medium by electronic means and whether or not transiently or incidentally to some other use of this publication, without the written permission of the copyright holder except in accordance with the provisions of the Copyright Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licencing Agency Ltd., 90 Tottenham Court Road, London, England W1P 9HE. Applications for the copyright holder’s permission to reproduce any part of the publication should be addressed to the publishers.
Dichjarazione
The authors and publisher have used their best efforts in ensuring the correctness of the
information contained in this book. They do not assume, or hereby disclaim, any liability to
any party for any loss or damage caused by errors or omissions in this book, whether such
errors or omissions result from negligence, accident or any other cause.
Catalogu di a Biblioteca Britannica in Dati di Publicazione
Un registru di catalogu per stu libru hè dispunibule da a Biblioteca Britannica
ISBN 978-3-89576-696-1
Stampa
ISBN 978-3-89576-697-8 eBook
© Copyright 2024 Elektor International Media
www.elektor.com
Editor: Glaucileine Vieira
Prepress Production: Elektor
Printers: Ipskamp, Enschede, Paesi Bassi
Elektor is the world’s leading source of essential technical information and electronics products for pro engineers, electronics designers, and the companies seeking to engage them. Each day, our international team develops and delivers high-quality content – via a variety of media channels (including magazines, video, digital media, and social media) in several languages – relating to electronics design and DIY electronics. www.elektormagazine.com
4
Cuntenuti
Cuntenuti
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Chapter 1 · Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.1 The Object-Oriented Programming for PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9 1.2 The CODESYS Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Chapter 2 · The Structured Text (ST) Programming Language . . . . . . . . . . . . . . . . 12 2.1 Conditional Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2 Calling the Standard Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.3 The Finite State Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.4 The Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2.5 The Loops. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 2.6 The Non-Instantiated Function Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.7 The Non-Instantiated Function Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 2.8 Writing an Expandable PLC Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Chapter 3 · The Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 3.2 The Class Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 3.3 The Structured Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 3.4 The Structured Variables Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 3.5 Passing Structures to the Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 3.6 The Structure Pass Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.7 The Array of Structures and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 3.8 The Array of Objects Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 3.9 Calling Multiple Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 3.10 The Sequence Activation Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Chapter 4 · The Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 4.2 The Methods Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 4.3 The Methods Parameters Pass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5
Object-Oriented PLC Programming with CODESYS
4.4 The THIS Keyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 4.5 The THIS Keyword Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 4.6 The Wrappers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 4.7 The Wrappers and Method to Method Passing Demo . . . . . . . . . . . . . . . . . . . . . 117 4.8 Two Production Lines for the Sequence Activation Project . . . . . . . . . . . . . . . . . . 127 Chapter 5 · The Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 5.2 The Property Software Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 5.3 The Properties as IO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 5.4 The Properties as IO Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Chapter 6 · The Inheritance and Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . 165 6.1 The Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 6.2 Inheritance Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 6.3 The Deep Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 6.4 The Method Override . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 6.5 The Override and Super Keyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 6.6 The Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 6.7 The Polymorphism Software Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Chapter 7 · The Access Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 7.1 The Public. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 7.2 The Private . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 7.3 The Protected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 7.4 The Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 7.5 The Application Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 Chapter 8 · Interfaces and Abstractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 8.1 The Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 8.2 The Interface Software Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 8.3 The Interfaces Vs Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 8.4 The Multiple Interfaces Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 8.5 The Interfaces and Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 8.6 The Interfaces and Polymorphism Demo. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 8.7 The Object Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
Contents Chapter 9 · The Delegation and Advanced FSM . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
9.1 The Delegation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 9.2 The Object Pointers and References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 9.3 The Object Pointers and References Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 9.4 Advanced FSM Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 9.5 The FB_INIT Constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 9.6 Advanced FSM Demo Part 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 9.7 The Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 9.8 Advanced FSM Demo Part 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 9.9 The State Initializer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
7
Documenti / Risorse
![]() |
elektor DSO3D12 Modular and Scalable Control Systems [pdfManuale d'istruzzioni DSO3D12 Modular and Scalable Control Systems, DSO3D12, Modular and Scalable Control Systems, Scalable Control Systems, Control Systems, Systems |