Why combine signals?
Many reasons. Here's mine:
Some LabVIEW blocks can take in a number of signals. One example is the scope-like display and other graphs. You can give it multiple channels and it will draw them.
The same for the Write to File block. You can send it a dynamic signal containing multiple measurements. It will write them as columns to a spreadsheet.
What the block doesn't do is give meaningful names to these columns, because it doesn't have a clue what it's logging.
LabVIEW has a Set Dynamic Data Attributes block that allows you to tell what (among other things) the column name for a signal is.
You'll need a block for each of your signals. In my case I'm sending seven signals, so my flow will have seven blocks on the flow diagram.
And these seven blocks take significant horizontal space of the workflow, without giving the user much insight of what's happening.
I prefer to only show in the main flow what's necessary to understand what's going on and why a process is branching left or right.
For the reader, it is enough to see that the data is logged to a spreadsheet. The Set Dynamic Data Attributes blocks don't add any visual insight.
I wanted to move the details of the data logging to a separate block, so that the main flow only showed a Write To Excel block. That's enough info for the main flow.
But it wasn't easy. I didn't find a solution on the web (my specialty ). I had to do loads of trial, error and guesswork before I got it right.
That's why I'm writing this article - in case I have to do this again later.
Passing a dynamic flow as Parameter
I knew how to club multiple measurements in a dynamic signal, with a Merge Signals block.
The difficulties came up when I wanted to move the result to a separate flow. Surfing and reading didn't really help and I couldn't find an example that did the same.
So I moved to trial and error. Use any block that I knew was related to dynamic data and try it. I had one day of frustration, and then success.
Here's how to do it:
On the submodule, define an array. That will be your input parameter. Drop a numeric control on it so that it becomes a numeric array.
Then link that block with the first Set Dynamic Data Attributes block.
This will automatically insert a Convert to Dynamic Data block.
But then there's something you have to change: right-click on that converter, and select properties.
Then select 1D array of scalars - multiple channels.
That's it. On the Front Panel, link the array with an input parameter.
You can now link your merged signals with your submodule:
LabVIEW will again automatically insert a block: Convert from Dynamic Data. You don't need to change that block.
That's it actually. You can now link your merged signals to your submodule.
Before:
After:
Top Comments