Trigger Queues (Statechart Module)

LabVIEW 2010 Statechart Module Help

Edition Date: June 2013

Part Number: 372103F-01

»View Product Info
Download Help (Windows Only)

Each statechart has one or more associated trigger queues. The LabVIEW Statechart Module uses these queues, which operate in a first-in first-out (FIFO) manner, to handle triggers that you send to the statechart. The statechart checks these queues during each iteration of the statechart.

Asynchronous statecharts have an external queue and an internal queue. The external queue stores triggers that you send to the statechart by using the Send External Trigger function. As long as the statechart is in memory, you can send triggers to the external queue from any VI. You also can send triggers to the external queue from a parallel thread in the caller VI. For example, you can have one While Loop that executes the Run Statechart function and a parallel While Loop that executes the Send External Trigger function.

Note  By default, the external queue is a LabVIEW queue. When executing a statechart on a real-time (RT) target, you can use the Statechart Code Generation page of the Project Library Properties dialog box to specify that the external queue is an RT FIFO to ensure that the queue is deterministic by restricting the size of the data. You specify this size, and other queue options, by using this dialog box.

The internal queue, which is a circular buffer, stores triggers that you send to the statechart by using the Send Internal Trigger function. You can use this function only in an action of a state or transition. This usage means you cannot modify the internal queue by using the caller VI.

Note  By default, the internal queue can hold ten triggers. You can change this number by using the Statechart Code Generation page.

Synchronous statecharts have an internal queue but not an external queue. This configuration means that you do not use a Send External Trigger function to send triggers to a synchronous statechart. Instead, you can wire triggers directly to the Trigger input of the Run Statechart function. If you do not wire a value to this input, the LabVIEW sends the NULL trigger to the statechart.

Note  You typically do not send triggers to synchronous statecharts. Synchronous statecharts begin an iteration according to the flow of data through the block diagram of the caller VI.

Asynchronous Statecharts and Queue Priority

Asynchronous statecharts begin an iteration only after receiving a trigger from the external queue. The statechart checks the external queue only if the internal queue is empty. For example, consider the following scenario:

  1. You use the caller VI to send a trigger to the external queue of an asynchronous statechart. Sending this trigger causes the statechart to begin an iteration.
  2. During this iteration, the statechart sends several triggers to the internal queue.
  3. Also during this iteration, you use the caller VI to send a second trigger to the external queue.

In this scenario, the statechart stores the second trigger in the external queue. However, the statechart does not check the external queue until the internal trigger queue is empty.


Not Helpful