文件名称:
LabVIEW Queued State Machine Architecture.pdf
开发工具:
文件大小: 803kb
下载次数: 0
上传时间: 2019-06-29
详细说明:LabVIEW Queued State Machine Architecture 详细使用方法讲解,高清,每一页都十分清晰!articles in the now discontinued publication: LabVIEW
Technical resource Guide". the subject was introduced by Jeff
Parker (Winter, 1995)and elaborated and modified by Greg
Fowler(Spring, 1996)and Lance Butler(Winter, 1996).The
National instruments website hosts various knowledge-base
articles and tutorials matching the key word: "Queued State
Machine. National Instruments Kevin Hogan produced a
useful presentation and web cast on this same subject matter that
continues to be available as of this writing. NI LabVIEW
courses from labview basics ii to the advanced course all cover
material on queued state machine architecture. over the years
the queued state machine has gained advocacy and widespread
use in large LabVIEW-based applications in the developer
community. In light of this situation, an NI forum thread: 'Please
Don' t Do It emerged in June 2006 that engages a lively
discussion that questions QSM-PC architecture suitability in
certain lab vieW coding scenarios
Queued State Machine Producer Consumer Design Objects
Generally, a queued state machine is a LabVIEW programming
method that sends commands and other data from multiple
source points (i.e. producer points), such as from user events and
3/32
from one or more parallel processes, and gets these handled in
one state machine process (i.e. destination consumer point)in
the order in which they were added to the queue. Figure 1 is the
simplest high-level illustration of the QSM-PC design. Figure
2 adds detail to this illustration, and Figure 3 is the equivalent
LabVIEW implementation these illustrations will be used
through-out this article to clarify the features and functions of
the QSM-PC architecture
Blocklayout of Queued State Machine
E/ET
LOOP
[/
3
CUMMANISHANDLEROrPRUCESSIR
f Consumer/
S
SuoYI
PIICESS T
PROCESS2
PROGESSN
(/
Figure 1 Shows four high-level objects of queued state machine producer consumer
architecture. I=Queue reference;' 2=User events object (producer of commands and
data) 3=Commands processor(consumer process that handles commands and
data) 4= Parallel SubvI processes (producer of commands and data)
4/32
ANBTORTy80 ed state Macti加B
EvN区
STATEN
QuEuE
15
An PARALLEL
PARALLEL
PARALLEL
PROCESS
PROCESS
PROCESS
Figure 2. Queued state machine producer consumer architecture showing data flow
and objects inside the consumer process.
鲁一
State Machine
ET▲
12
a于
1.3
5/32
Figure 3. Lab vIEW implementation of the queued state machine producerconsumer
architecture. Labeled objects I through 4 match those of the high eve/illustrations in
Figure 1 and Fiqure 2.
A High Level Layout of QSM-PC Architecture
a general layout of QSM-PC architecture comprises of the four
objects annotated by the encircled numerals 1 to 4 shown
in Figure 1. These objects are namely: (1)Queue reference
object;(2)User events object(optional for head-less embedded
applications that require no user interaction);(3)Main state
machine object; (4)One or more parallel processes subVI objects
Note that label 1.1 in Figure 1, is a broken-line representation
of the queue reference object. The broken -line is meant to show
that the subvi processes are able to access and interact with the
queue from within the Subvi by referencing the queue by name
without having to wire the queue reference to the SubVis. see
the lab vieW implementation of this illustration in Figure 3 and
the QsM-PC LabVIEW Example included in this article Queue
reterence access by name also allows a queue reterence to be
use by dynamically launched Vis by Vi Server and is discussed
further under the section: Item (1) Queue Reterence Object.
6/32
Items(2)and (4 )are the multiple producer processes responsible
for sourcing commands and data and adding them to the queue
Item(3)is the single consumer process which removes
commands and data from the queue name: Main Queue and
acts on these in the order added to the queue. One important
rule is that, for any one queue reference you should only have
one consumer process while there can be one or more producer
processes. This rule ensures that the consumer process is the
central command processing center where each and every
command added to the queue reference gets handled In the
abVIEW QSM-PC layout of Figure 3 the consumer process is
part of the open top level block diagram, rather than a subVi
This is to facilitate manipulation of controls, indicators and
properties of front panel objects in the main program. The
discussion that follows elaborates further on items 1 through 4
and shows their LabVIEW implementation examples
Item(I) The queue Reference
The queue reference in the QSM-PC architecture emulates a
command and data messaging pipe-line where the queue
accepts data packets added by one or more producer objects
and releases these data packets to one consumer object. Figure
7/32
2 elaborates on the queue reference message communication
function by showing data packet migration through the queue
originating from producer objects and ending at the main
consumer object the consumer object loop in item 3 figure
2 includes queue managementⅥs. TheseⅥ s are from labⅥEW
s queue palette vi shown in Figure 4 which are used to
accomplish various functions such as creating the queue, adding
data to the queue, and releasing data from it
dds Data t t4
CReates a new caeue
Queue
E*isTEa Ricun
Refererce
Q雨国以,是端
as queue配e,
E详sUeL
obtan queue Enqueue Ee
8D想et
Epe他语ti1
to be fc自
element In rort of
Preview que,…, Get queue s
9fgq厚 T Prip rity
Destroys the
Handing
Queue Refrence
Release queue Enqueue Ela
s配g
Releases Bata the
Q诵
Dequeue Eent Flush Queue
Figure 4. LabvIEW s queue palette VIs used in the queued state machine producer
consumer programming method.
Creating The Queue Reference or Grabing Existing Queue
Reference
8/32
The lab vieW queue implementation shown in Figure 3 creates a
queue reference of the name: Main Queue using the Obtain
Queue Vifrom LabviEW s queue palette; see LabVIEW
implementation code in Figure 5. Subsequent and repeated
implementation of this same code will grab an existing queue
reference of the specified name. this is typically done to give
access of queue reference to sub vis which also avoids the need
to wire a queue reference to the subVi
Qee阳ame一Mne
metre RefereR Ce
Element Data Type
oSTAIE1 T
obtain Queue eference
Figure 5. LabvIEW code for creating a new queue reference for the queued state
machine or grabbing an existing one
Two inputs are essential for creating the queue: (a)The Queue
Name In this example the queue name is Queue Maini and
(b) Data Packet Definition:
Shown annotated in Figure 6 is a sample data packet
recommended for the queued state machine discussed in this
article. This data packet constitutes a cluster containing two
pieces of information: ()a type def enumerated constant also
9/32
known as a Function 'STATE constant; and (i a variant ' Data
item. this data packet definition means that the resulting queue
reference can only carry data elements that conform to this data
packet
客T
A平A
Lists Coaster StaRe M知ces
型
Packages aRy Data for Processing a
Hat wan prcess the selected
The Respectie State case
ER一D3置aake!rQe时
Figure 6. Recommended data packet for queued state machine producer consumer
architecture discussed in this artic/e
The typedef enumerated constant enlists your chosen names of
the state machine cases in the consumer process. each time a
command is added to the queue, the enum should be set to the
machine s state name which will handle or process the
command. Therefore, the type-def state items are like
command names that designate which state name contains the
relevant code for processing the command Typical function
enum state names. INITALIZE DlE
ERROR′,and
EXI should be included
You must ensure that the enum constant is a copy of a
typedef-based custom control so that you can add or remove
10/32
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.