Feedback on NI Community

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Queued State Machine

More on Run-Time Logic Implementation in Consumer Case

Each time a consumer state machine case finishes executing, there is opportunity for intervention of program flow by the addition of enum state commands at the back or front of queue or even to replace the queue elements with new enum command instructions. This feature, known as run-time logic programming is an important advantage of the QSM architecture. Figure 15 shows use of a SubVI to execute STATE 5. If the SubVI in STATE 5 can instruct detects emergency alarm conditions. The program will immediately pre-empt (replace) all enum commands in the queue and execute the emergency shut down enum case instead.

 

 Figure 15. Consumer Run Time Logic.png

 

Figure 15. Run time logic programming with option to pre-empt program flow.

 

 

Avail and Update Parameters and Variables in Any State Machine Case

Another feature worthy of note in the QSM architecture is the shift registered cluster data flow line that passes through all state machine cases see Figure 16 (not shown in Figure 3). This flow line avails and allows update of parameters and variables as needed inside every state machine case. You use LabVIEW’s unbundled-by-name utility to access parameters and variables and use the bundle-by-name utility to update the same. Figure 16 shows these operations within enum case: STATE 6 of the consumer loop.

 

 Figure 16. Shift Register Feature.png

Figure 16. Shift registered cluster of parameters and variables that can be accessed and updated within every case of the state machine in the consumer process

 


Item (4) Parallel Process SubVIs

 

SubVIs that run in parallel with the main consumer process complement and add useful functions to the QSM-PC architecture; see item 4 in Figure 1, Figure 2, and Figure 3.  SubVIs that can be run in this manner are data communications, data acquisition (DAQ), results analysis, and much more. These SubVIs primarily behave as producer processes and access the queue reference by name, using the method described in Figure 5. This is the same queue reference that is shared with the consumer process. This method of access to the queue reference precludes the need to wire the queue reference to SubVIs as seen in the LabVIEW implementation of Figure 3 which creates transparent routes of communication. The block diagram looks tidy when SubVIs access queues in this manner.

 

 

Building Both Multi-Consumer Functionality in LabVIEW Code

By creating multiple queue references of unique names you can have multiple consumer points in your LabVIEW code. Each consumer point (i.e.. at the dequeue VI) will own the respective queue reference of a unique name and will behave as the only destination point for all packets sent via that queue reference. In this way you can implement a network of transparent data migration paths from multiple producer points to predefined destination points in your code.  The one important rule here is that to send data to a given consumer point you must use the queue reference owned by the respective consumer process.

 

The example in Figure 17 shows a block diagram for SubVI 1 which behaves as a consumer process for the queue name: ‘Q1’ but which also grabs queue references: ‘Main Queue’; Q2; and Q3. In this case, SubVI 1 can use queue reference Q1 to accept commands and data from other producer points while and at the same time SubVI 1 can send commands and data to consumer processes that own the other queue references.

 

 

 Figure 17. Multi C and P.png

 

Figure 17. Block diagram for a subVI that behaves as the consumer process for Q1 but is also the producer process for queue references: (1) Main Queue; (2) Q2; and (3) Q3

 

 

 

Summary

 

The QSM –PC architecture design attributes, object features, and function are covered in the forgoing discussion. The goal is to help master the fundamentals in the applied use of this method to develop parallel process LabVIEW programs, and specifically the  strategic use of queue references as a network of communication pathways for commands and data transfer between multiple parallel processes. The fundamentals discussed here are applicable to many other variations of the QSM -PC architecture. This article will conclude with pertinent highlights covered in the discussion.

 

  • QSM-PC is a Parallel Process Enabler

The QSM –PC architecture establishes the use queue references as data messaging pipelines that communicates information between parallel processes in an as-needed and timely manner. This type of communication solves one of the serious challenges in parallel process programming.

 

  • Multiple Producer and Single Consumer Points

In the QSM –PC architecture, queue data elements can be added from various points in the code known as producer points. However, queue elements are taken out of the queue from only one destination point, called the consumer point. This consumer point is considered to be the owner of the queue reference.

 

  • Global Access to the Queue via the Queue Name

Global access to a queue reference means that the queue can bee seen by SubVI processes without the need of wiring the SubVIs to a queue reference. This creates transparent routes of communication and greatly simplifies the code.

 

  • Empowers Programs to Build Run Time Logic.

QSM –PC programs can implement logic to change the latest command sequence by adding commands to the front of the queue or by emptying the queue to reset the program flow and add new commands thereafter.

 

  • Multi Consumer Queue References Creates a Network  of  Data Pathways

Parallel process SubVIs which themselves use the QSM-PC architecture create a network of communication pathways with multiple producer and consumer points. This allows one parallel process to control the flow multiple parallel process subVIs.

 

References

 

Parker, J., LabVIEW Technical Resource Publication. Winter 1995.

 

Fowler, G.,LabVIEW Technical Resource Publication. Spring 1996.

 

Butler, L,. LabVIEW Technical Resource Publication. Winter 1996.

 

 

Example included with This Article

 

A LabVIEW program is included with this article on QSM PC architecture implementation. The file QSM –PC EXAMPLE.LLB contains a main program and two subVIs that run in parallel. This example implement most of the QSM –PC command and data communication features discussed in this article.

 

 

 

 

Download All
Message 11 of 12
(3,966 Views)

Thanks! You might want to compose a new document over in the community instead.

0 Kudos
Message 12 of 12
(3,956 Views)