Wednesday, August 18, 2010

Dataflow Languages

LabView is a dataflow language. Most programming languages that are popular today are NOT dataflow languages. So what is unique about a dataflow language?

Most programming languages involve typing a list of commands that are run in the order they appear. Dataflow languages consist of nodes that run as soon as they can and many can run in parallel. A node is anything that waits for input(s) and provides output(s). In our previous example, terminals and the increment function were all individual nodes. The wires were not nodes. They were the connections between the nodes. These connections represent the "flow" of data. The control terminal immediately has its value from the front panel. Since all inputs are satisfied it can run right away. The output of the terminal is the same number. This allows the increment function to run since all its inputs are satisfied. The indicator terminal cannot act yet because it does not have its input. Once the increment function provides its output, then the indicator can act. At that point, all the nodes on the block diagram have run to completion.

If this concept is confusing, then you are in luck. It is not important to fully grasp the idea. It will come to you as you continue learning LabView. Eventually this will seem simple.

Consider the following example. I have expanded the block diagram of the original example and added an additional indicator. I also clicked the single run arrow to generate results. Notice that the "Numeric 2" indicator shows 4, and the new "Numeric 3" indicator shows 5.


This example shows two paths that run in parallel. Once the first increment executes, providing the value that eventually ends up at the "Numeric 2" indicator terminal, there are two parallel paths. The first path simply puts the incremented value in the Numeric 2 indicator on the front panel. The second path performs another increment and puts the value in the Numeric 3 indicator. This value was incremented twice. This is not a particularly useful piece of code, but it helps show how dataflow languages work. Neither of the two parallel paths can run until their inputs are available. The input to each path is the output of the first increment function. The program will finish once all final output nodes are satisfied (in this case, the numeric 2 and numeric 3 terminals).

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Projects

My Blog List

Give support

Give support
Encourage Me through Comments & Followers

Followers