LabVIEW – More LCOD
By Rob Maskell
()
About this ebook
Whether you are a new LabVIEW programmer or an old seasoned one, the quest always remains the same: building better programs with our "favourite software tool > LabVIEW". The aim of this book is to offer some guidance, discussing designs that use LCOD Hidden Data, Abstraction, Cohesion and Coupling methods.
A significant part of the book is structured around five LCOD questions for Hidden Data that the author posed to start the COC (Cluster of Constants) evolutionary process:
- How can we remove all and any types of LabVIEW constants out of the diagram?
- How can we remove those constants out of the program to file in a disk storage?
- How can we recover those constants from the file storage system back into the diagram?
- How can we reinstall the constants into the diagram at load or run time or any time?
- How can we make an online and offline editor to edit all those removed constants?
This book is about the evolution of the author's design work using LabVIEW LCOD over the past 35 years.
About the Author
Rob Maskell has more than three decades of experience with LabVIEW as a programmer, trainer, technical products distributor and industrial system hardware fabricator. He has trained more than 3,000 engineers in the use of LabVIEW software and was instrumental in establishing NI in Europe.
Related to LabVIEW – More LCOD
Related ebooks
Embedded Expert's Guide to C Rating: 0 out of 5 stars0 ratingsLearn to Code with C: Program with the world's most popular language on your Raspberry Pi Rating: 5 out of 5 stars5/5C Programming Language The Beginner’s Guide Rating: 0 out of 5 stars0 ratingsARM® Cortex® M4 Cookbook Rating: 4 out of 5 stars4/5Simply Programming C# and Visual Basic …: C# and Visual Basic Rating: 0 out of 5 stars0 ratingsMicroprocessor and Microcontroller Interview Questions: A complete question bank with real-time examples Rating: 0 out of 5 stars0 ratingsFundamentals of Instrumentation and Measurement Rating: 5 out of 5 stars5/5Essential Guide to CAN Communication Rating: 0 out of 5 stars0 ratingsEtherCAT A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsProjects With Microcontrollers And PICC Rating: 5 out of 5 stars5/5Embedded Systems Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsSimulation-Driven Electronics Design: The easy way to design your own electronics projects (English Edition) Rating: 0 out of 5 stars0 ratingsSystem Design for Telecommunication Gateways Rating: 0 out of 5 stars0 ratingsMastering BeagleBone Robotics Rating: 5 out of 5 stars5/5Programming Arduino with LabVIEW Rating: 3 out of 5 stars3/5Mastering Siemens S7: A Comprehensive Guide to PLC Programming Rating: 0 out of 5 stars0 ratingsSignals and Systems For Dummies Rating: 2 out of 5 stars2/5Emerging Actuator Technologies: A Micromechatronic Approach Rating: 0 out of 5 stars0 ratingsDigital Electronics with Arduino: Learn How To Work With Digital Electronics And MicroControllers Rating: 5 out of 5 stars5/5Design an RP2040 board with KiCad: Creating Raspberry Pi Pico-compatible PCBs Rating: 0 out of 5 stars0 ratingsGSM - Architecture, Protocols and Services Rating: 1 out of 5 stars1/5Practical Robotics in C++: Build and Program Real Autonomous Robots Using Raspberry Pi (English Edition) Rating: 0 out of 5 stars0 ratingsLearning IoT with Particle Photon and Electron Rating: 0 out of 5 stars0 ratingsUSB Complete: The Developer's Guide Rating: 4 out of 5 stars4/5PLCs for Beginners: An introductory guide to building robust PLC programs with Structured Text language Rating: 0 out of 5 stars0 ratingsSCADA supervisory control and data acquisition Third Edition Rating: 0 out of 5 stars0 ratingsFeedback Control Theory Rating: 5 out of 5 stars5/5ESD: Design and Synthesis Rating: 0 out of 5 stars0 ratingsAnalog Automation and Digital Feedback Control Techniques Rating: 0 out of 5 stars0 ratingsFundamentals of Electronics 2: Continuous-time Signals and Systems Rating: 0 out of 5 stars0 ratings
Technology & Engineering For You
Algorithms to Live By: The Computer Science of Human Decisions Rating: 4 out of 5 stars4/5Scary Smart: The Future of Artificial Intelligence and How You Can Save Our World Rating: 4 out of 5 stars4/5Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future Rating: 4 out of 5 stars4/5Ultralearning: Master Hard Skills, Outsmart the Competition, and Accelerate Your Career Rating: 4 out of 5 stars4/5Travel English Dialogues Rating: 3 out of 5 stars3/5Dataclysm: Who We Are (When We Think No One’s Looking) Rating: 4 out of 5 stars4/5UX/UI Design Playbook Rating: 4 out of 5 stars4/5How to Build a Car: The Autobiography of the World’s Greatest Formula 1 Designer Rating: 4 out of 5 stars4/5Basic Engineering Mechanics Explained, Volume 1: Principles and Static Forces Rating: 5 out of 5 stars5/5What We Owe The Future: The Sunday Times Bestseller Rating: 4 out of 5 stars4/5Broken Money: Why Our Financial System is Failing Us and How We Can Make it Better Rating: 5 out of 5 stars5/5Selfie: How We Became So Self-Obsessed and What It's Doing to Us Rating: 4 out of 5 stars4/5The Official Highway Code: DVSA Safe Driving for Life Series Rating: 4 out of 5 stars4/5Agile Project Management: Scrum for Beginners Rating: 4 out of 5 stars4/5Stop Asking Questions: How to Lead High-Impact Interviews and Learn Anything from Anyone Rating: 5 out of 5 stars5/5The Concise 33 Strategies of War Rating: 5 out of 5 stars5/5Artificial Intelligence Revolution: How AI Will Change our Society, Economy, and Culture Rating: 5 out of 5 stars5/5Transport for Humans: Are We Nearly There Yet? Rating: 5 out of 5 stars5/5Sad by Design: On Platform Nihilism Rating: 4 out of 5 stars4/5Summary of Nicolas Cole's The Art and Business of Online Writing Rating: 4 out of 5 stars4/5AI Superpowers: China, Silicon Valley, and the New World Order Rating: 4 out of 5 stars4/5Games and Bereavement: How Video Games Represent Attachment, Loss, and Grief Rating: 0 out of 5 stars0 ratingsCyberpsychology Rating: 0 out of 5 stars0 ratingsBeginning AutoCAD® 2022 Exercise Workbook: For Windows® Rating: 0 out of 5 stars0 ratingsWriting Is Designing: Words and the User Experience Rating: 5 out of 5 stars5/5Information Doesn't Want to Be Free: Laws for the Internet Age Rating: 0 out of 5 stars0 ratingsArtificial Intelligence: A Guide for Thinking Humans Rating: 4 out of 5 stars4/5
Reviews for LabVIEW – More LCOD
0 ratings0 reviews
Book preview
LabVIEW – More LCOD - Rob Maskell
PREFACE
LabVIEW Component Oriented Design (LCOD) is a method that uses several simple Design Rules
that can be helpful in programming LabVIEW applications.
I have been using some of the LCOD methods for over 30 years. In 2010 I started writing about this LCOD experience on my website and eventually developed some programming notes on LCOD. This sat for a while until I finally edited and expanded them into this book.
Whether you are a new LabVIEW programmer or an old seasoned one like me, the quest always remains the same, building better programs with our favourite software tool > LabVIEW
.
The aim of this book is to offer some guidance and help in achieving this.
I have been programming and using many design methods and languages for over half a century. In 1988, I wrote the first LabVIEW & LabWindows training courses for Europe.
I have trained over 3000 people on how to program in LabVIEW.
This book is about the evolution of my design work using LabVIEW LCOD over the last 35 years. I started working on this LCOD methodology, unknowingly and naturally in 1987 in my first LabVIEW programs. It developed very slowly from there. What’s 35 years?
Just a heads up: in many pages of the book, you will find the abbreviation COC
. Don’t panic, it is not Clash of the Clans
. COC
serves as an abbreviation for the term used on many pages, namely Cluster of Constants
. Pronounce it C – O – Cs : no, not the other way.
Cluster of Constants
or COCs are at the heart of this book. They may, after a while, invoke mental pictures and even dreams.
COC may even become LV jargon, an acronym. How is that COC coming along?? Is it a Type Def? Definitely make it a Type Def!
Another term used throughout the book: when you read Component
, think Oh yes, a special type of LabVIEW SubVI or a LCOD state engine
. These three terms Component, SubVI and LCOD state engine may be used alternately throughout the book.
This book may be the final hurrah
of an older LabVIEW groupie, almost!
A big thank you to Jeff Kodosky and his development teams over the years before I go. It has always been a great delight to play with your creation, considering the software tools we were using before it came along.
Thank you also to Jim Truchard and NI for driving the Virtual Instruments and LabVIEW products to market.
And just to complete my professional work cycle, recently I have found a young engineer to continue with my LabVIEW creations who will probably markedly improve them.
Enjoy the book.
INTRODUCTION
Just to make this book a little more fun, I have included some chapters of my experiences with various technologies from the 1960s to the present. It started with a 1967 PDP 8i that was first used to provide biomedical instrumentation solutions and then the newer evolving technology that was used to meet requirements in many university research fields, then later industrial test, automation, instrumentation, T&M, agriculture, horticulture, marine, military calibration and repair, also some embedding, sensors and a little on teaching LabVIEW worldwide.
abbreviation >> LV = LabVIEW
abbreviation >> COC = Cluster of Constants
abbreviation >> LCOD = LabVIEW Component Oriented Design
DESIGN CONCEPTS AND METHODS OF LCOD PROGRAMS
Before the mid-1990s, this LCOD abbreviation did not exist, although I am sure some were playing with the concepts. Finally, in the mid-1990s, these concepts were made real and introduced in the book A Software Engineering Approach to LabVIEW by Jon Conway and Steve Watts.
It outlined the design concepts and methods of LCOD programs, with four main focuses:
Hidden Data
Abstraction
High Cohesion
Low Coupling
It is a great book and explains three of the focuses very well.
This present book shows a better way for hidden data
and can become a companion and or an adjunct to the original book.
The book's purpose is to expand the understanding and use of LCOD.
Hidden Data
Hidden Data in this book means: removing constants from diagrams; in fact removing them from the program entirely, on to disk.
This book will show a graphical method to achieve hidden data: an important LabVIEW step. Over several chapters this new hidden data method will be expanded to completion. This new LCOD design method also develops into a full programming methodology.
Abstraction
Abstraction in this book means a programming methodology that takes concepts, data, information and ideas based in computer
terminology and language, such as data types and formats, hardware descriptions, port #s, bit #s etc. and elevates those meanings to more meaningful human
language word descriptions and concepts. Abstracting will allow a more human context into the program solution in the actual LabVIEW front panels, diagrams and data.
Abstraction promotes a language elevation or conversion to take place for clarity of meaning.
Examples of abstraction or language conversion or elevating meaning
Computer
words > Digital Output Port A has Bit # 1 True. The abstraction: in human words this becomes Water Pump #1 = ON
Computer words > ADC Channel # 5 > Reading is 3 VDC. The abstraction: in human words becomes > Manometer # 1 Pressure = 2000 Pascals (by calibration).
To achieve these abstractions:
LCOD usually uses Named State Engines (Components) (Nouns).
LCOD State Engines Case Selectors are controlled by a series of enum constants as (verbs) (actions).
Enum Constants and Enum Controls
Abstraction happens in many places in LabVIEW. One example is inside a State Engine diagram, when the controlling enums, as (verbs), are wired to a Case Selector.
Enum AbstractionEnum abstraction
The Text Data
in the enums that are wired to the Case Selector are now displayed in each individual case state’s heading or label.
Abstracting is very helpful for the programmer, adding meaning and documentation to the diagram.
Cohesion
Cohesion in this book means: focused and singular-purpose SubVIs or Component, such as Calibrate this sensor
or do this type of test
. Not combining those two tasks together in one SubVI. Cohesion is all about splitting or separating these types of combo SubVIs into separate focused, cohesive pieces for clarity and ease of maintenance.
Not doing half a computation in one SubVI and the rest in another SubVI.
Coupling
Coupling in this book means: Low/No Coupling throughout a LabVIEW diagram is imperative.
Coupling occurs between SubVIs in two ways, Code and Data.
Code Coupling
If there is a SubVIs used inside a program in two locations and you edit the SubVI in one part of the program to make it work correctly there but forget about the other location’s use of the same SubVI, you immediately create an accidental coding coupling error. Whenever the SubVI runs in this forgotten location, it could result in I/O malfunction, data errors and the like. Great confusion can arise.
It is always better to create two separate SubVIs with different distinct names to stop accidental code coupling. Name them for their function, location and purpose. This makes each a private SubVI.
All the encouragement about reuse
of SubVIs throughout a program may not always be totally beneficial. LabVIEW is very efficient in compiling small code size SubVIs.
Data Coupling
Data coupling is more common.
It is very easy for data coupling to get out of control. For example, it can happen when private data and public data usage becomes confused. private data in this book is data that only a single SubVI knows, uses and has access to. public data, on the other hand, is available to all SubVIs of a program. For instance, if two SubVIs share private data between them and the private data in one SubVI is modified to achieve a certain result, there will be a data coupling error when the other SubVI runs. This is especially true for calibration data and constants used in formulas.
OTHER AREAS OF FOCUS
I would like to add a couple more items to the list of four above for LCOD focus.
Public and Private Data
Continuing on with public and private data ideas. Program designs that separate public and private data correctly will often exhibit strong cohesion and low coupling naturally. Get the public and private data rules sorted and the program will become simpler and more stable.
Enums as Type Defs
Make all Enums into Type Defs (verbs). Use them everywhere but especially for driving the SubVI State Engine’s Case Selectors.
Also do make all controls and indicators that are repeatedly used throughout the whole program into Type Defs.
This is especially true for complex front panel clusters of controls or indicators.
These Type Defs will create the consistent look and feel
uniformity in the front panels.
Some examples:
Cluster Type DefinitionsCluster type definitions
These two Control examples are clusters.
Also, numeric, strings, booleans, arrays, charts and graphs that operators use, once sized, fonted, coloured and so on, need to be Type Defs.
As you will see later, all the Cluster of Constants or COCs used in the hidden data method are Type Defs. Type Defs take a little time to build, yet do it, as it will pay off handsomely.
These rules are especially applicable to large programs where you cannot hope to hold the details about all the SubVI’s front panels, diagrams and data in your mind. Rely on Type Defs to manage a large part of it all for you. You will know you are globally winning in your design efforts when you change a Type Def and save it, and the computer sits for some time updating all the other copies throughout the program. Smile when this happens.
If you are building small programs, still use these development points, as someday you will build a big program and all the early training will pay off.
Programming Ecology
I call these ideas and methods programming ecology
, as the design is nurtured, kept clean and healthy. Take your time and don’t short circuit the build; stay on cue and keep the design flow right through to the end.
Ecology. Go around and pick up all the garbage and clean up the mess so it can breathe.
This introduction, hopefully, will whet the appetite for some LCOD learning and fun.
CHAPTER 1
THOUGHTS ON AND EXPERIENCES OF LABVIEW PROGRAMMING
Focus:
LabVIEW Program Design
Using LCOD
The book uses a series of LabVIEW applications to demonstrate the LCOD methods.
All the applications panel and diagram snippets are from various versions of Australian and New Zealand Standards
Windows, Walls, Doors, Roofs and Facade Industrial Testers.
The first example shown is a front panel for these types of industrial tester applications.
This front panel shows the main application’s entry point for the operator at startup.
Notice the row of