Error Cluster Constant for LabVIEW 2011

Error handling is an important but challenging part of any large application.  In an attempt to make it easier to generate specific errors throughout your application, AristosQueue and company has created a new Error Cluster Constant.  An early version is available for you to evaluate and download from here.

8-26-2011 1-33-42 PM.png

I am in the process of lobbying them to create a VI Package file to make installation easier, but I strongly encourage anyone that’s interested in more advanced error handling to download and evaluate this new tool.

On a related note, the latest version of the Structured Error Handler API is available here.

Scripting for LabVIEW Released!

After a few weeks of vacation, I’m back in Austin and have some hot news for all you Large LabVIEW App developers out there.  Scripting is now officially available!

For all you ‘rebels’ who have been using scripting for years, you can now do so with a clean conscience.  Download the installer from this link and follow the instructions to activate your new scripting license.

For those of you who are unfamiliar with scripting, this is not to be confused with scripting languages like Python or Perl.  LabVIEW scripting exposes additional VI Server properties and methods that allow more programmatic control over the development environemnt.  Why is this valuable?  For an example of what can be done with scripting, check out JKI’s new Right-Click Framework.

So why didn’t we expose this sooner?  Scripting was initially developed for internal programming purposes, but was soon discovered by LabVIEW aficionados.  Concerns regarding forward compatibility and unsupported functionality were one of the largest reasons we didn’t make this formally available before now.  For now, LabVIEW scripting resides within NI Labs and is not formally supported by the Applications Engineering group.  To discuss questions, feedback or any problems, visit the API Community.

VIPM Makes Managing Re-Use Libraries in LabVIEW Easier

Distributing code and re-use libraries can be a surprisingly difficult task.  Luckily for us, our friends at JKI have come up with an extremely elegant and professional solution for LabVIEW called the VI Package Manager.  If you’ve never heard of this tool, I strongly encourage that you check it out.  In addition to making code management easier, VIPM lets you download all the OpenG libraries, which adds some very useful functionality to LabVIEW.

To understand when VIPM is especially useful, consider several common examples of when you want to distribute your code:

  1. You have a set of common VIs that you want to re-use in multiple applications
  2. You are working in a team-based environment and other developers need your code
  3. You want to share a set of development tools with a colleague
  4. You want to post VIs online for the community to use

These all seem simple enough, but now lets throw a wrench in the works with a few common tasks:

  • Updating code – it’s common to make changes or updates to shared libraries during development.  All team-based environments should be using some form of source code control to track and manage changes from multiple developers, but it can still be challenging to make sure you have the right version of all the subVIs installed and in-use at the same time.
  • Professional distribution – how do you share code in such a way that it minimizes the work required by the recipient?  Instead of having to move multiple files into the correct directory locations, everything is installed automatically and appears on the palettes.
  • Dependency management – ever opened up an application on a new machine and discovered that it’s broken because you forgot some dependencies from a re-use library or a toolkit you forgot to install?
  • Multiple LabVIEW Versions – how do you make sure that the updates have been made available in all versions of LabVIEW, and not just the most recent version?

As you’ve probably already guessed, these are some of the biggest challenges that VIPM is designed to help with.

There are two flavors of VIPM: the professional version facilitates creation of ‘VI Packages’ and the free version enables anyone to install and manage these packages.  You can download packages from a number of places online, or VIPM can automatically scan dedicated servers to see what’s available.  I’ve also spoken with a number of LabVIEW users who are using the professional version of VIPM to distribute code internally during development.

As an example, Simon recently posted a set of custom controls for use in LabVIEW.  Minutes after making them available, Jim had created a package and posted it on the document, which made installing them in LabVIEW a breeze.  A few clicks, and the swanky new controls were in my controls palette.

ni_lib_ni.com_inspired_controls-1.1.0-1.vip

These were updated a few times, and each time I just downloaded the package and VIPM took care of replacing the old controls.

Download VIPM and give it a try yourself.  Thanks to JKI for making such a great tool!

Download VI Package Manager

Applying ’12 Steps to Better Software’ to LabVIEW

If any of you subscribe to Joel on Software, you may have come across this article where he provides a 12-step checklist for developing quality software. These recommendations are just as true of LabVIEW development as they are of any other programming language:

1. Do you use source control?
2. Can you make a build in one step?
3. Do you make daily builds?
4. Do you have a bug database?
5. Do you fix bugs before writing new code?
6. Do you have an up-to-date schedule?
7. Do you have a spec?
8. Do programmers have quiet working conditions?
9. Do you use the best tools money can buy?
10. Do you have testers?
11. Do new candidates write code during their interview?
12. Do you do hallway usability testing?

In Joel’s opinion, if you can’t answer ‘Yes’ to at least 10 of these, you have serious problems with your development process that could slow you down and lead to low-quality code. I went through these with NI’s NPI process in mind and happily scored a 12.

As a LabVIEW developer, if you would like to share insights or feedback on any of these topics, we’re eagerly hoping to hear from you…

Taking a Bite Out of Upgrades and Preparing for LabVIEW 2009

To anyone who is afraid or worried about upgrading, we hear you and we’ve made changes to help.  Back in January of this year, David Fuller wrote an entry on John Pasquarette’s blog  describing what we’re doing in R&D to reduce problems associated with upgrading.  To summarize:

  • Our move towards an annual release schedule results in incremental changes and updates, which mitigates the risk associated with introducing several completely new features at once, as we did with LabVIEW 8.0.
  • The regular release cycle provides more opportunities for guidance from customers as features evolve – consider the changes to the LabVIEW Project Explorer between 8.0 and 8.5 as an example of this evolution.
  • Internal alignment across all teams means better coordination between all software products, drivers, and hardware

However, it’s important to realize that there is something you can do to help.  Try the Beta of LabVIEW 2009.  Upgrade issues are top priority for us - the trick has always been finding these problems, and for that we need your help. 

As of April 2nd, the entire platform of the next version of LabVIEW is now in Beta and available for your evaluation – this means all software, toolkits and drivers. 

As always, the new version contains new features that aim to improve developer productivity and application performance.  To see a list of new features and provide feedback to the community, click here.

Finally, for more resources on best-practices for upgrading your application, consult this guide on ni.com.

Professional User Interfaces in LabVIEW

The flexibility of front panel objects in LabVIEW is something many people, including myself, take for granted.  We quickly drop down charts, knobs, and sliders, leaving them unchanged, and as a result, most LabVIEW programs have an unmistakably similar look and feel.  Of course, this makes it much easier to spot in a lab or during cameo appearances on shows like MythBusters, but many people are looking for ways to make more impressive and even ‘sexy’ user interfaces.

The success of commercial products like the iPhone are clear examples of the growing desire for intuitive user interfaces, but the world of engineers and scientists is not exempt.  There are a lot of practical reasons why a clear and appealing UI is valuable for a large LabVIEW application, as it can reduce learning curves and improve the effeciency of the user.

What many LabVIEW developers don’t realize, is the level of customization and flexibility that LabVIEW controls and indicators provide.  Realizing this, my friend and colleage, SimonH, set out to see just how easy it would be to make some impressive controls and indicators for LabVIEW that broke the mold.  He’s posted his first few examples in his new UI Interest Group, but I happen to know he’s got a lot more up his sleeve.  Join his group and look for more soon!

Preview of ni.com theme

Here’s another particularly slick user interface that was made in LabVIEW for OptiMedica

lvui

Advanced Application Specific Architecture Resources

About a month ago I wrote a blog on LabVIEW application architectures, but I wanted to supplement that with links to more advanced resources that are specific to certain applications and offer a more holistic insight into the task of designing your LabVIEW applications.

  • A Primer for Machine Control – If you’re building a large system for machine control using CompactRIO and aren’t sure where to start, this should help.  It includes example applications and insights into networking and how to manage multiple tasks.
  • 100+ Open-Source Reference Architectures- our systems engineering group is frequently exposed to common architectural challenges faced by LabVIEW programmers on large applications.  To keep from re-inventing the wheel, they’ve been publishing elegant solutions to these recurring problems.  Examples include Simple Messaging Reference Library, which offers an alternative to shared variables for network communication, 3D Obstacle detection for machine control applications, and a variety of example application architectures.
  • TestStand Architecture Series – as automated test systems are becoming larger and more complex, it’s becoming increasingly important to architect your code to ensure scalability, quality and re-usability.  This series of content was written largely by NI Alliance Partners who have extensive experience with applications of this nature.  The architecture applications in any language is one of the biggest challenges any software programmer faces.

Compared to the task of designing code, the task of actually developing it is often the easiest par.  Without careful consideration, many programmers get the ‘re-factor’ twinge about half-way into the development process.  If any of this sounds familiar, spend some time looking through these resources to get some insight into paradigms that might help you and your application succeed.

New Software Engineering Tools for LabVIEW

There is perhaps no more appropriate place to announce the arrival of two new toolkits for large application development than here in the Large LabVIEW Application Community.  The Desktop Execution Trace and Unit Test Framework Toolkits have been introduced to automate common practices for software engineering and help developers improve code quality.

The Desktop Execution Trace Toolkit facilitates dynamic code analysis for low-level debugging of applications during runtime.   The Unit Test Framework is designed for automated unit testing and requirements-based validation of software.

Feedback from users in highly regulated industries was one of the primary motivations for creating these products.  As we continue to invest in LabVIEW for large applications, we are benefited by feedback on these products and the needs of our users.

So to those of you who have had a chance to use these and similar tools, please use this community as an opportunity to share and exchange your ideas.  We look forward to hearing form you.

Architecting an Application to Avoid Spaghetti

One of the most appealing things about LabVIEW is that you don’t need to be a computer scientist to write fairly large and complex software. For many, their journey with LabVIEW starts in school or at a benchtop with a simple application to quickly acquire some data. Once they’re hooked on the ease of graphical programming, it’s only a matter of time beforethe ideas start flowing, and pretty soon they’re off developing amazing applications like a mind-controlled wheel chair, the world’s largest particle accelerator, or how about a 3D Space Ship that flies through a starflied.

The problem is that the same approach people use when throwing together a prototype or a proof of concept will land them in a world of pain if they don’t ever stop and consider fundamental questions like, “how should I architect this application?” All too often, I see the tangled mess of spheghetti code emerge as the result of thoughtless, or ill-planned development.

badCode.pngFor most people, their very first experience with LabVIEW leads to messy, un-readible code.  Even LabVIEW gurus have humble beginnings.  The expert G developer, D Natt, was kind enough to send me a screenshot of his very first LabVIEW program. Let the image on the right serve as an example of what not to do. If you find yourself wishing you had 8 more screens to see a single block diagram, or if your block diagram looks anything at all like this one, you may want to consider giving more thought to the architecture of your application. As an exercise, see how long it takes to determine what the VI on the right actually does.

It’s important to realize that spaghetti code is not unique to LabVIEW. As someone who started with text-based languages, I’ve seen plenty in all sorts of different languages. The difference is that it’s a lot easier to write graphical code that will run, even if it’s completely illegible. When the result doesn’t work correctly or yields unexpected performance, it can be very difficult to debug and many prefer to point the finger at LabVIEW rather than acknowledge their own lack of foresight or experience.

So lets turn our attention to how we can architect our LabVIEW application. Start with the main problem you’re trying to solve and figure out what the software needs to be able to do in order to be considered ‘succesful.’ The criteria that emerges from this assessment will help you make informed decisions about how the code should be structured. This is, in many cases, the product of experimenting, prototyping and developing proof of concepts that highlight the areas of difficulty and help you understand what type of information or data will need to be shared between different ‘pieces’ of an application.  At this point, we need to take a step back and make sure we understand design patterns.

LabVIEW Design Patterns.pngA ‘Design pattern’ refers to a template that serves as the building blocks for software. If you have an application that requires a responsive user interface, consider how many other developers have been faced with the exact same requirement. You’re not alone, and there’s no reason you should be starting from scratch. Design patterns are universal to programmers in any programming language. They save you time by helping you avoid reinventing the wheel and give us the solutions to common problems that have evolved over time to be the best, and most appropriate solution. If you’re new to design patterns, check out the File >> New dialog in LabVIEW (show on the left). This is a great place to get started with some basic design patterns that are very specific to LabVIEW. Be sure to read the descriptions to understand exactly what problemsthey can best help you solve.

I also recommend visiting expressionflow.com. Anthony Lukindo wrote an excellent, indepth article on the QSM-PC (Queued State Machine – Producer / Consumer) design pattern, which is a fairly common and very useful pattern for a-sychronous computations in a fairly large application.

For those of you familiar with text-based design patterns, AristosQueue posted a great article filled with examples of how to map classics like the Factory Design Pattern to LabVIEW using object-orientation.

The JKI State Machine also serves as another great template for developing clean code.

Architecting a high-quality piece of code ensures that it’s readible, scalable, maintainable and reduces the chance that errors or incorrect behavior will occur. I’ve focused a lot on design patterns, but don’t lose sight of the fact that just is one small piece of the puzzle. You’ll also want to think about how the application can be modularized and design APIs early on. Oh and of course, documentation is paramount.

One final word of caution: keep it simple and pick the archicture best suited to what you’re doing. But as always, have fun

Is LabVIEW a Programming Language?

Is LabVIEW A Programming Language?

Yes.

As a LabVIEW fanatic and enthusiast, I commonly field this question from customers and text-based programmers on a regular basis.At first glance, graphical programming appears abstract and so radically different from C and similar languages, that for many it’s hard to grasp how this grid of wires and colored blocks could possibly represent code.

While studying for my degree in computer engineering at the University of Missouri, I regularly programmed in C++, Java, and spent many long hours in labs going through the painful process of writing x86 assembly and even VHDL.I was also an avid web developer and had written many programs in a combination of HTML, PHP and Adobe Flash for a research lab at the school.Sadly, I had never used LabVIEW or graphical programming, but I did have one friend who kept egging me on to try it out.He claimed it would make my life much easier and that I could do all the same things I was already doing in a fraction of the time.

When I finally learned LabVIEW after beginning work at National Instruments, it was like a whole new world had opened up to me.It all made so much sense and I found myself wishing I’d listened and saved myself many all-nighters in college.

If you look back at 1986, the year LabVIEW 1.0 was released; graphical programming was a part of the natural progression. Apple had just announced the first graphical user interface ever for the commercial market.The use of computers had previously been entirely through the command-line and it seems logical that only text-based programming was around up until then.

Enter graphical interfaces… enter graphical programming. It was simple at the time, but the concept of dataflow made the representation of information and the relationships between operations to be performed much more apparent and easy for someone without a programming background to understand. It took off and became the foremost tool for anyone who wanted to control a bench top instrument and perform analysis in software.

These days, LabVIEW has evolved dramatically.  The abstraction LabVIEW provides still enables scientists and engineers to solve complex problems without worrying about lower-level details, but it still has the ability to control more granular aspects of your application and push that same graphical code down to the pin with FPGAs and embedded targets.What would’ve taken dozens of pages of VHDL can now be accomplished with just a few simple VIs in graphical code.LabVIEW is object oriented and open; developers can re-use libraries developed in .NET or other languages.Users can build professional, end-use applications for commercial re-sale.

The flexibility of the development environment even allows users to combine different models of computation within a single application.Dataflow can be combined with text-based *.mfiles or tools like Statechart to take advantage of the strengths of every paradigm.All of these different models of computations are compiled by LabVIEW into a single binary.

Because of the abstraction that is inherent to graphical programming and the investment we’ve made in the compiler, LabVIEW is even smart enough to perform optimizations in the background that result in performance that can often exceed that of text-based counterparts.This is especially true when optimizing applications for multiple cores, which is a growing concern as the personal computer continues to offer consumers more and more cores within a single machine without any significant gains in clock frequency.

At National Instruments, we even develop many of our software products and a large portion of LabVIEW itself in LabVIEW.For those of you who use Vision Builder, you’re using a LabVIEW application that spans roughly 5,000 VIs and is developed by a team of about 3 individuals.The fact is that LabVIEW is a programming language in every sense of the word and it presents users with more options and more flexibility than other monolithic environments.

Why do so many people still refuse to believe LabVIEW is a programming language?Perhaps after 23 years of development, LabVIEW is still just that far ahead of its’ time.

Share your thoughts on LabVIEW as a Programming Language!  Leave a comment below.