LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

template vi - simultaneous multiple usage

Excellent points, Jarrod. 🙂
 
Here are a few more:
  • One of the great advantages of LabVIEW compared to classical programming languages is the automatic and inherent parallelism of dataflow. Sequence structures enforce inescapable linear code, canceling that advantage.
  • Often, sequence structures are used to clumsily translate text code similar to cooking recipes, enforcing an order where none is needed.
    • Text based
      1. preheat oven
        • listen for phone to ring
      2. get flower
        • if you spill, cleanup and get back to 2
        • listen for phone to ring
        • etc.
      3. get water
        • If you spill, cleanup and get back to 3
        • listen for phone to ring
        • etc.
      4. get salt
        • If you spill, cleanup and get back to 4
        • listen for phone to ring
        • etc
      5. mix ingredients
      6. ...
    • LabVIEW
      1. Preheat oven while on the way to get flower, water, and salt in an order that is most convenient depending on the original location of the items. Try to use both hands if possible to get more than one ingredient at once (dual processor!). In case the phone rings, pick it up and continue working while talking on the phone. If you spill something (error condition), clean up and get the missing ingredient again.
      2. mix all ingredients (due to dataflow, this cannot happen until we have all ingredients (=all inputs contain data))
      3. ...
  • If you have a 10 frame stacked sequence and an error occurs in frame 1, there is no escape and frames 2-10 will need to needlessly execute before anything else can happen (unless you use the STOP icon, which has no place in any advanced code). Compare that to a clean state machine where the structure can be escaped or frames executed out of order at any time when needed.
  • Sequence structures are rarely needed. To enforce a mandatory execution order, often a single-frame flat sequence is sufficient.
  • Typically, the need for seqeunces is caused by poor and inefficient coding that breaks datafow, e.g. loss of dataflow due to overuse of local variables.

See also: http://forums.ni.com/ni/board/message?board.id=170&message.id=230714

Message 11 of 13
(777 Views)
Wouwaw! will revise all my codes...
-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 12 of 13
(754 Views)

Jarrod/altenbach,

Great explations.  If LabVIEW books were written more in this style there would be better LV programmers out there.

- Brad 

(formerly DRS Engineer)

0 Kudos
Message 13 of 13
(747 Views)