Summary
Your plant or equipment is assembled from objectsyour control should be, too. New tools deliver the productivity of OOP without the complexity.
Interfaces and Methods are two modern programming concepts which provide essential functionality for Object Oriented Industrial Programming (OOIP).Part 1 of this series introduced OOIP and showed how a control design is built by assembling self-contained objects in much the way the actual plant is assembled from self-contained objects as shown in Figure 1.
Figure 1: In OOIP, the Control Design is built from objects which match those in the physical plant or equipment design.
Part 2 of this series explained how OOIP uses new I/O mapping and configuration techniques, and this Part 3 will show how Interfaces and Methods are used to implement those new configuration techniques as well as other centralized services.
In OOIP, objects are distributed throughout a control design just like objects are scattered throughout a plant or piece of equipment.For instance, say a refrigerator manufacturing plant has an assembly line system, which has an insulation injection subsystem, which has a polyurethane processing subsystem, which has an isocyanate material subsystem, which has a tank subsystems.In this plant, there are thousands of sensor objects are distributed from the top-level assembly line all the way down to the tank subsystems and throughout adjoining branches.During the time the task-based programming approach described in Part 2 became popular, there was no practical way to implement central services which could accommodate the distributed nature of an OOIP design.The only solution was to centralize the entire design.Fortunately, newer development environments have implemented features which allow the best of both worlds: distributed control objects (so the control design can mirror the plant design) and centralized services (to manage these distributed objects).In Part 2 we introduced the analogy that the older task-based programming technique was akin to a strong centralized government where each tag had to be registered with the service it required (like the Bureau of Scaling, the Bureau of Alarming, the Burau of Persistence, and such). OOIP is more like self-governing society where citizens largely take care of themselves. But even the most ardent fan of small government agrees that some level of central government is necessary.How are these distributed objects configured?How are their alarms managed (aggregated, acknowledged and shelved)?How are their state values saved and restored in case of a power failure or controller replacement?Interfaces and Methods play a key role in managing these tasks.
A Method can be thought of as a Function which belongs to a Function Block and can be accessed through the instance of that Function Block.Figure 2 shows an example of the AnalogSensor Function Block which has an AcceptConfig Method and how an instance of AnalogSensor named L1 is placed on the isocyanate tank deep in the refrigerator manufacturing plant described earlier.At startup, a central service can read the configuration information from a central database and pass the configuration parameters to that instance by making a call to that instances AcceptConfig method using its full path name Plant.AS1.II1.PP1. Isocyanate.L1.AcceptConfig."
Figure 2: Methods are Functions which belong to a Function Block. An Instance of the AnalogSensor Function Block can be configured by calling the Instances AcceptConfig Method.
Methods also have access to their parent Function Blocks variables and can be overridden by Methods in extended Function Blocks.Methods can also have access control to limit access to the parent only (private), the parent and all extended Function Blocks (protected), or be open to all (public).
Interfaces are a tool for organizing access to a Function Blocks Methods.An Interface is a contract made by a Function Block to support a specific set of Methods and for those Methods to have a specific set of Inputs and Outputs.In addition to making Methods easier to manage, Interfaces allow Function Blocks which agree to that contract to be treated as a homogeneous group.A central service can then manage all the Function Blocks as a single set.For example, say we have a variety of types of Function Blocks which need to know if it is day or night as shown in Figure 3.Each of these Function Blocks agree to the DayOrNightInterface contract by adding the words Implements DayOrNightInterface to their declaration.Then, all instances of Function Blocks which have implemented the DayOrNightInteface (lines 3 and 4) can be assembled into an array of type DayOrNightInterface (lines 6 and 7).This array can then be used to notify the instances as a single group at dawn or dusk (Main implementation line 3).
Figure 3: Instances of Function Blocks which implement an Interface can be grouped in an array of that Interface type and then operated on as a set.
In traditional PLC programming, every function that needed to know if it is day or night would individually poll the light sensor. This is somewhat akin to the family vacation parody where each child in the station wagon repeatedly asks dad are we there yet?Using Methods and Interfaces as in Figure 3, the sensor is instead polled in one place and the functions are then notified when the status has changed.In this modern SUV, all the children quietly pursue their own interests trusting dad to let them know when they arrive.The parents can travel in peace.
The approach above works fine when the objects are all instantiated in the same program (i.e., for an SUV full of children where presumably the dad knows all his children).But further steps are required for Object Oriented Industrial Programing (OOIP) where instances of objects can be instantiated inside other objects and objects become distributed throughout the hierarchy of a plant design (such as in the refrigerator plant example above). In this type of system, additional features are used to allow the distributed objects to register themselves with a central service.This system is analogous to families taking a night Amtrak train on vacation where the dad lets the conductor know their destination and seat numbers.The conductor can then wake up each family when approaching their destination. This self-registration relies on a key feature in CODESYS shown in Figure 4.Every Function Block which needs configuration services implement the ConfigMgrInt Interface and has AcceptConfig and RegisterMyConfig Methods.The first line of the RegisterMyConfig method contains the call_after_global_init_slot attribute which causes that method to be automatically executed when the programs initiates.
Figure 4: Methods annotated with the call_after_global_init_slot Attribute are automatically executed at startup, allowing objects to autonomously register themselves.
The remainder of the registration and configuration process is shown in Figure 5. Each instance of each Function Block which implements ConfigMgrInt uses its RegisterMyConfig method to pass a pointer to itself, its Function Block name, and its Instance name to the RecieveObjectRegistration Method of the Configurator Central Service.The Configurator then places that information into an array of type ConfigMgrInt."The Configurator then obtains the configuration data for the configurable objects (from a CSV file or SQL Database), finds the matching instance name in the array, and uses the pointer that was provided by the object at initiation time to pass this data to each objects AcceptConfig method.The AcceptConfig Method then writes the data to the appropriate configuration inputs.
Figure 5: Methods which register themselves can then receive their configuration from a central source, such as a CSV file or SQL database. Follow the color coding to see the flow of information.
The actual implementation of the Configuration and Alarm central service is shown in Figure 6. Notice the Configuration service also includes ProvideConfigTitles and ProvideConfig methods.These methods allow the system to write a well-formatted configuration parameter file with the configurations grouped by Function Block type prefaced with a parameter name header line as shown in Figure 7. This file serves as an ideal starting point for the controls engineer to begin the configuration specification process.Once the plant or equipment is up and running, these methods can also be used to store the configuration values of specific instances. This is useful for saving tuning parameters or other changes made to specific instances during operation, or archiving snapshots of critical variable values so the state of the system can be restored after a power failure or controller replacement.
Figure 6: The ControlSphere Configuration library includes methods to obtain the configuration variable names and current data which are used to create a well-formatted template file and to save checkpoint/restart data sets.
Figure 7: The ControlSphere Configurator creates a template file grouped by Function Block name and including the variable names and default values for every object in the design. It also creates a file to archive and restore tuning parameters and state variable.
Object Oriented Industrial Programming allows engineers to quickly create highly intuitive control designs by assembling control objects in the same way matching hardware objects are assembled in the plant or equipment.In addition to the concepts of OOIP described in Parts 1 and 2 of this series, Methods and Interfaces are two additional key features of OOIP.These features provide a way for objects which are distributed throughout the plant hierarchy to receive central services such as configuration, alarming, persistence, and checkpoints.Just as the best of other general software advancements have been adopted into the industrial controls world, Object Oriented Industrial Programming is following that same pattern.OOIP is clearly the future of Controls Engineering.
Part 1 of this article can be found here.Part 2 of this article can be found here.A clearinghouse for open-source OOIP Functions Blocks and design examples can be found here.A demo on Configurable I/O mapping can be viewed here.
The CODESYS IDE used for the examples in this article can be downloaded at no charge from this site.The download includes a complete SoftPLC which will run for 2 hours between resets.
For a video demonstration of Object Oriented Industrial Programming, Simulation, and Configuring Objects, see this video.
For more elaborate examples of Discrete, Batch, and Continuous control system designs implemented in OOIP, see this video.
This article is dedicated to the memory of Chuck Piper, K9TRN, of Madison, Wisconsin who tolerated and mentored a pesky 11-year old through building his first novice transmitter, and was key to launching a lifelong passion for electrical engineering.
Gary L. Pratt, P.E. is president of ControlSphere Engineering.Mr. Pratts career began with Chevron Corporate Engineering in 1982 and he recently retired as the president of the CODESYS Corporation of North America.He holds patents in industrial controls and now concentrates on sharing his knowledge and experience with the next generation through IEC61131-3 and CODESYS training and consulting.He can be reached at gary@controlsphere.pro
Check out our free e-newsletters to read more great articles..
The rest is here:
Object Oriented Industrial Programming (OOIP) Part 3: Interfaces and Methods - Automation.com
- Research, Evaluation and Learning at the International Rescue Committee - World - ReliefWeb [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Conserving Biodiversity with AI - BBN Times [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- DevOps Fundamentals You Ever Wanted To Know - hackernoon.com [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Another Perspective on Evictions - Bacon's Rebellion [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Amitabh Bachchan on fans alternate job suggestion: My job is now insured - The Indian Express [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Will You Soon Download Packaging Machine Controls from the Internet? - Packaging Digest [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- 5 free resources every data scientist should start using today - The Next Web [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Who's hoping to make an Epic impact on Green Bay area music scene with a new concert venue? | Streetwise - Green Bay Press Gazette [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Industrial robots are dominating but are they safe from cyber-attacks? - TechHQ [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Friday Rant - Rise of the Rogue-Bots? - Diginomica [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Important Reasons Why You Should Pick RoR As Your Web-Based Development Project - Customer Think [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Portrait of the software developer as an artist - ComputerWeekly.com [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Python may be your safest bet for a career in coding - Gadgets Now [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- 1Password is coming to Linux - ZDNet [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- IBM creates an open source tool to simplify API documentation - TechRepublic [Last Updated On: August 10th, 2020] [Originally Added On: August 10th, 2020]
- Mastercard : Accelerate Ignites Next Generation of Fintech Disruptors and Partners to Build the Future of Commerce - Marketscreener.com [Last Updated On: August 12th, 2020] [Originally Added On: August 12th, 2020]
- Expanding the Universe of Haptics | by Lofelt | Aug, 2020 - Medium [Last Updated On: August 12th, 2020] [Originally Added On: August 12th, 2020]
- UX Designer Salary: 5 Important Things to Know - Dice Insights [Last Updated On: August 12th, 2020] [Originally Added On: August 12th, 2020]
- Persistent memory reshaping advanced analytics to improve customer experiences - IT World Canada [Last Updated On: August 12th, 2020] [Originally Added On: August 12th, 2020]
- NextCorps and SecondMuse Open Application Period for Programs that Help Climate Technology Startups Accelerate Hardware Manufacturing - GlobeNewswire [Last Updated On: August 12th, 2020] [Originally Added On: August 12th, 2020]
- Buried deep in the ice is the GitHub code vault humanity's safeguard against devastation - ABC News [Last Updated On: August 12th, 2020] [Originally Added On: August 12th, 2020]
- Top 12 Most Used Tools By Developers In 2020 - Analytics India Magazine [Last Updated On: August 12th, 2020] [Originally Added On: August 12th, 2020]
- Facebook's React 17 JavaScript library: Here's why its top feature is 'no new features' - ZDNet [Last Updated On: August 12th, 2020] [Originally Added On: August 12th, 2020]
- CORRECTING and REPLACING Anyscale Hosts Inaugural Ray Summit on Scalable Python and Scalable Machine Learning - Business Wire [Last Updated On: August 12th, 2020] [Originally Added On: August 12th, 2020]
- Google: Here's how much we give to open source through our GitHub activity - ZDNet [Last Updated On: August 12th, 2020] [Originally Added On: August 12th, 2020]
- How Chriselle Lim And Joan Nguyen Created Bmo, The Coworking Space And Virtual Classroom Of The Future (With A Childcare Twist) - Forbes [Last Updated On: August 13th, 2020] [Originally Added On: August 13th, 2020]
- How Will Public Libraries Adapt To New School Year Norms? - Book Riot [Last Updated On: August 13th, 2020] [Originally Added On: August 13th, 2020]
- Google: We'll test hiding the full URL in Chrome 86 to combat phishing - ZDNet [Last Updated On: August 13th, 2020] [Originally Added On: August 13th, 2020]
- How to install Python 3 and PIP 3 on Ubuntu 20.04 LTS - Linux Shout - H2S Media [Last Updated On: August 13th, 2020] [Originally Added On: August 13th, 2020]
- What are Bitcoin Wallets: Everything You Need to Know - Programming Insider [Last Updated On: August 13th, 2020] [Originally Added On: August 13th, 2020]
- JSHint is Now Free Software after Updating License to MIT Expat - WP Tavern [Last Updated On: August 13th, 2020] [Originally Added On: August 13th, 2020]
- How to learn JavaScript: These are the best online courses - Mashable [Last Updated On: August 13th, 2020] [Originally Added On: August 13th, 2020]
- What developers need to know about inter-blockchain communication - ComputerWeekly.com [Last Updated On: August 14th, 2020] [Originally Added On: August 14th, 2020]
- Introducing the CDK construct library for the serverless LAMP stack - idk.dev [Last Updated On: August 14th, 2020] [Originally Added On: August 14th, 2020]
- IBM asked software developers to take on the wrath of Mother Nature - The Drum [Last Updated On: August 14th, 2020] [Originally Added On: August 14th, 2020]
- Aspire Technology Launches First Truly Secure Public Blockchain for Creation of Digital Assets - GlobeNewswire [Last Updated On: August 14th, 2020] [Originally Added On: August 14th, 2020]
- GM Creates And Shares New Workplace Safety Technologies - Pulse 2.0 [Last Updated On: August 14th, 2020] [Originally Added On: August 14th, 2020]
- Key Considerations and Tools for IP Protection of Computer Programs in Europe and Beyond - Lexology [Last Updated On: August 14th, 2020] [Originally Added On: August 14th, 2020]
- The state of application security: What the statistics tell us - CSO Online [Last Updated On: August 14th, 2020] [Originally Added On: August 14th, 2020]
- Open Source: What's the delay on the former high/middle school on North Mulberry? - knoxpages.com [Last Updated On: August 14th, 2020] [Originally Added On: August 14th, 2020]
- The Risks Associated with OSS and How to Mitigate Them - Security Boulevard [Last Updated On: August 14th, 2020] [Originally Added On: August 14th, 2020]
- news digest: Microsoft launches open source website, TensorFlow Recorder released, and Stackery brings serverless to the Jamstack - SD Times -... [Last Updated On: August 14th, 2020] [Originally Added On: August 14th, 2020]
- Build Your Own PaaS with Crossplane: Kubernetes, OAM, and Core Workflows - InfoQ.com [Last Updated On: August 17th, 2020] [Originally Added On: August 17th, 2020]
- ISRO Is Recruiting For Vacancies with Salary Upto Rs 54000: How to Apply - The Better India [Last Updated On: August 17th, 2020] [Originally Added On: August 17th, 2020]
- Does technology increase the problem of racism and discrimination? - TechTarget [Last Updated On: August 17th, 2020] [Originally Added On: August 17th, 2020]
- CORRECTING and REPLACING Anyscale Hosts Inaugural Ray Summit on Scalable Python and Scalable Machine Learning - Yahoo Finance [Last Updated On: August 17th, 2020] [Originally Added On: August 17th, 2020]
- In the City: Take advantage of open recreation, cultural and park amenities - Coloradoan [Last Updated On: August 17th, 2020] [Originally Added On: August 17th, 2020]
- Exploring the future of modern software development - ComputerWeekly.com [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Hadoop Developer Interview Questions: What to Know to Land the Job - Dice Insights [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- SiFive Opens Business Unit to Build Chips With Arm and RISC-V Inside - Electronic Design [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Use Pulumi and Azure DevOps to deploy infrastructure as code - TechTarget [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Why ASP.NET Core Is Regarded As One Of The Best Frameworks For Building Highly Scalable And Modern Web Applications - WhaTech [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- NITK figures 4th in Google Summer of Code ranking - BusinessLine [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Learn More About Dynamo for Revit: Features, Functions, and News - ArchDaily [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Linux Foundation showcases the greater good of open source - ComputerWeekly.com [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Programming language Kotlin 1.4 is out: This is how it's improved quality and performance - ZDNet [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Top 10 Languages That Paid Highest Salaries Worldwide In 2020 - Analytics India Magazine [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Programming language Rust: Mozilla job cuts have hit us badly but here's how we'll survive - ZDNet [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- In-App Bidding Gathers Steam, But Adoption Looks Nothing Like Header Bidding On The Web - AdExchanger [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- 13 thoughts on Fitting Snake Into A QR Code - Hackaday [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Newham test and trace app was designed by man who grew up in the borough - Newham Recorder [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- 'Trapped in a code' the fight over our algorithmic future - Open Democracy [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Telegram launches one-on-one video calls on iOS and Android - The Verge [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- AWS Controllers for Kubernetes Will Be A 'Boon For Developers' - CRN: Technology news for channel partners and solution providers [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Coding within company constraints - ComputerWeekly.com [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Open Source and Open Standards: The Recipe for Success Featured - The Fast Mode [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- How Intel helped give the worlds first cyborg a voice - The Next Web [Last Updated On: August 21st, 2020] [Originally Added On: August 21st, 2020]
- Tiger Woods, Rory McIlroy near bottom of field at The Northern Trust - ESPN [Last Updated On: August 22nd, 2020] [Originally Added On: August 22nd, 2020]
- Intel Owl OSINT tool automates the intel-gathering process using a single API - The Daily Swig [Last Updated On: August 22nd, 2020] [Originally Added On: August 22nd, 2020]
- IOTA Foundation presents the current projects in the mobility industry - Crypto News Flash [Last Updated On: August 22nd, 2020] [Originally Added On: August 22nd, 2020]
- How 'Fortnite' and 'Second Life' Shaped the Future of Indian Market - Santa Fe Reporter [Last Updated On: August 22nd, 2020] [Originally Added On: August 22nd, 2020]
- Apple Enters $ 2 Trillion Club, Github's Chinese Counterpart And More In This Week's Top News - Analytics India Magazine [Last Updated On: August 22nd, 2020] [Originally Added On: August 22nd, 2020]
- As world grapples with pandemic, schools are the epicenter - ABC News [Last Updated On: August 24th, 2020] [Originally Added On: August 24th, 2020]
- Why Businesses Should Embrace Modernizing Their Legacy Applications - TechBullion [Last Updated On: August 24th, 2020] [Originally Added On: August 24th, 2020]
- Is It Time To Rename RPG? - IT Jungle [Last Updated On: August 24th, 2020] [Originally Added On: August 24th, 2020]
- Phantasy Star Online programmers on breaking new ground and their Diablo-style isometric prototype - Polygon [Last Updated On: August 24th, 2020] [Originally Added On: August 24th, 2020]
- How To Learn To Program In Python By Playing Videogames - Analytics India Magazine [Last Updated On: August 24th, 2020] [Originally Added On: August 24th, 2020]
- New Microsoft program to help develop the quantum computing workforce of the future in India - Microsoft [Last Updated On: August 24th, 2020] [Originally Added On: August 24th, 2020]
- How the Docker Revolution Will Change Your Programming, Part 1 - Walter Bradley Center for Natural and Artificial Intelligence [Last Updated On: August 24th, 2020] [Originally Added On: August 24th, 2020]
- The art of developing happy customers - ComputerWeekly.com [Last Updated On: August 24th, 2020] [Originally Added On: August 24th, 2020]