- Posted on: 2021-12-09
We recently helped a few clients with their existing code. It was interesting to see how much they relied on probes to understand what their LabVIEW application was doing and brought us back many years ago, before we started using Symplify.
Probes along with “Retain Wire Values” and “Highlight Execution” are all very useful features of LabVIEW as a software development environment. Using them in the course of your development can answers some questions but they have significant drawbacks:
- They only supply a single value at a time
- It is usually difficult to understand
- Any time you need to “understand” our code, you need to place them again
- Distributing them in many VI or parts of your code can time consuming
- They don’t provide a good idea of timing of code execution
The list could go much longer but instead, we would rather talk about what you can do to overcome all those problems. The simplest way to get started is to create a simple piece of code that will store a series of strings. Now you are free to write messages in any section of your code along with current values using “Format into String”:
Inside this new VI, append a time stamp. We typically use:
Make sure that this VI is “Non reentrant execution” and call it wherever needed. The result is a string that you can read and display.
The first 2 challenges that you will likely face are the following:
- Some of your messages will be sent at very high frequency and “flood” the log
- This VI causes a “memory leak” because the internal string keeps growing
There is a simple solution to each of those. First, limit the size of the string inside your VI to 250,000 characters. This is a very manageable size for your CPU. Second, where messages are sent too often, add a condition to trigger sending the data. A “value change” or a two seconds timer are typical criteria we use internally quite a bit.
How about adding the values of the Error Cluster whenever a software exception is thrown? Maybe you want to log this information to disk from time to time to keep “snapshots” about how your application is performing.
Give it a try. It takes about 30 minutes to get setup and after you start using it, you’ll see how much easier and fun your software development will become.