⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timing deterministic control loops - developer zone - national instruments.mht

📁 LabVIEW关于定时的研究的技术文档和例程
💻 MHT
📖 第 1 页 / 共 5 页
字号:
<H2>=E7=9B=B8=E5=85=B3=E9=93=BE=E6=8E=A5 - Developer Zone</H2>
<DIV class=3Dfnavbox>
<UL>
  <LI><A =
href=3D"http://zone.ni.com/devzone/cda/epd/p/id/3259">Staggering the=20
  <B>Scan</B> <B>Clock</B> and Update Clock</A><BR>
  <LI><A =
href=3D"http://zone.ni.com/devzone/cda/tut/p/id/2731">Continuous =
Waveform=20
  Acquisition Using <B>Scan</B> <B>Clock</B> =
Gating</A><BR></LI></UL></DIV>
<H2>=E7=9B=B8=E5=85=B3=E9=93=BE=E6=8E=A5 - Products and Services</H2>
<DIV class=3Dfnavbox>
<UL>
  <LI><A =
href=3D"http://sine.ni.com/nips/cds/view/p/lang/zhs/nid/206391">NI=20
  PXI-8108 RT</A><BR>
  <LI><A=20
  =
href=3D"http://sine.ni.com/nips/cds/view/p/lang/zhs/nid/206555">=E7=94=B5=
=E6=BA=90=E9=99=84=E4=BB=B6</A><BR></LI></UL></DIV></DIV></DIV></DIV>
<DIV id=3Dprimarycontentcontainer>
<DIV class=3Dnoindex>
<H1>Timing deterministic control loops</H1>
<DIV class=3Ddocdetails>
<DIV class=3Dratings>16 =E8=AF=84=E7=BA=A7 | <STRONG>2.75</STRONG> out =
of 5</DIV><!-- Read in other language section --><A=20
href=3D"javascript:window.print()"><IMG class=3Dbottomalign height=3D13 =
alt=3D""=20
src=3D"http://zone.ni.com/images/global/us/icons/print.gif" width=3D18 =
border=3D0>=20
=E6=89=93=E5=8D=B0</A> </DIV></DIV>
<DIV id=3Dpagearea>
<DIV class=3Dnoindex>
<H3>=E7=9B=AE=E5=BD=95</H3>
<OL>
  <LI><A =
href=3D"http://zone.ni.com/devzone/cda/tut/p/id/4324#toc0">Overview</A>
  <LI><A =
href=3D"http://zone.ni.com/devzone/cda/tut/p/id/4324#toc1">Using =
Software=20
  to time control loops</A>
  <LI><A =
href=3D"http://zone.ni.com/devzone/cda/tut/p/id/4324#toc2">Anchoring =
loop=20
  times to hardware clock</A>
  <LI><A =
href=3D"http://zone.ni.com/devzone/cda/tut/p/id/4324#toc3">Synchronizing =

  input and output clocks</A>
  <LI><A =
href=3D"http://zone.ni.com/devzone/cda/tut/p/id/4324#toc4">Staggering=20
  input and output clocks</A></LI></OL></DIV><A name=3Dtoc0></A>
<H2>Overview</H2>
<P>One of the major factors of a control system is response time. In =
general, a=20
control loop cyclically acquires a single point from an input channel, =
processes=20
it, and in response, outputs a single point on an output channel. =
Control loops=20
simply repeat this process. Although a computer=E2=80=99s processor =
speed and the number=20
of instructions inside the control loop generally limit the maximum =
frequency of=20
a control loop, a programmer has some flexibility when tuning a control =
loop=E2=80=99s=20
responsiveness between inputs and outputs. Consider the following =
figure, which=20
illustrates a simple timeline of inputs and outputs for a software-timed =

acquisition.<BR></P>
<P><IMG height=3D108 alt=3D""=20
src=3D"http://zone.ni.com/cms/images/devzone/tut/timing_deterministic_con=
trol_loops.gif"=20
width=3D396 border=3D0></P>
<P>The minimum time between input and output depends on the amount of =
processing=20
that must be done on each input. Thus we must guarantee that the output =
command=20
occurs only after the processing is complete. The overall loop cycle =
time is=20
simply the sum of the processing time and any built-in delay.<BR></P><A=20
name=3Dtoc1></A>
<H2>Using Software to time control loops</A><BR></H2>The easiest way to =
time a=20
control loop is to use software tools to wake up the software thread at =
regular=20
intervals. One such tool is the "Wait Until Next ms Multiple" VI. =
<BR><BR><IMG=20
height=3D118 alt=3D""=20
src=3D"http://zone.ni.com/cms/images/devzone/tut/a/5b519f241037.gif"=20
width=3D242><BR><BR>One disadvantage, of course, is the millisecond =
resolution of=20
the function, which limits you to 1 kHz loop rates maximum. In the =
software=20
timing scheme, all three components - input, processing, and output, are =
subject=20
to software jitter.<BR><BR><A=20
onclick=3D"window.open('http://zone.ni.com/devzone/jsp/largeImage.jsp?ima=
gename=3D/cms/images/devzone/tut/a/5b519f241038.gif&amp;language=3Dzh-CN'=
,'awindow','scrollbars=3Dyes, resizable=3Dyes');return false;"=20
href=3D"http://zone.ni.com/devzone/cda/tut/p/id/"><IMG=20
src=3D"http://zone.ni.com/cms/images/devzone/tut/a/5b519f241038.gif" =
width=3D525=20
border=3D0></A><BR><A=20
onclick=3D"window.open('http://zone.ni.com/devzone/jsp/largeImage.jsp?ima=
gename=3D/cms/images/devzone/tut/a/5b519f241038.gif&amp;language=3Dzh-CN'=
,'awindow','scrollbars=3Dyes,resizable=3Dyes');return false;"=20
href=3D"http://zone.ni.com/devzone/cda/tut/p/id/">[+] =
=E6=94=BE=E5=A4=A7=E5=9B=BE=E7=89=87</A> <A name=3Dtoc2></A>
<H2>Anchoring loop times to hardware clock</A><BR></H2><BR>In order to =
achieve=20
faster loop rates, and to remove some of the software jitter from our =
loop, it=20
is desirable to examine some hardware timing solutions.<BR><BR>Starting =
with=20
NI-DAQ 6.7, AI SingleScan anchors a thread in software to the =
board=E2=80=99s hardware=20
scanclock. Thus the scan rate defines the frequency of the loop. With =
this=20
method, we can achieve loop rates much faster than 1 kHz as long as the =
code=20
inside the control loop does not lag the scanning process. When AI =
SingleScan is=20
called, it waits for the next rising edge of the scanclock before it =
executes.=20
While it waits, it puts to sleep the calling time-critical thread, so =
other=20
lower-priority threads can execute.<BR><BR>It also is possible to use an =
E=20
Series STC counter to time control loops by adding the "Wait" operation. =
<A=20
name=3Dtoc3></A>
<H2>Synchronizing input and output clocks</A><BR></H2><BR>An easy way to =
ensure=20
that there is a regular delay between the input and output events is to =
perform=20
inputs and outputs at the same time. You can do this by simply sharing a =
common=20
clock for A/D and D/A conversions to ensure that both occur =
synchronously. In=20
the case of National Instruments Data Acquisition boards, a shared clock =
can be=20
the output of a counter routed over RTSI to both the update and scan =
clocks, the=20
scan clock routed to the update clock, the update clock routed to the =
scan=20
clock, etc. The drawback, however, is that outputs are always one loop =
cycle=20
behind the inputs. Refer to the following figure for more information =
about the=20
delay.<BR><BR><IMG height=3D156 alt=3D""=20
src=3D"http://zone.ni.com/cms/images/devzone/tut/a/5b519f241039.gif"=20
width=3D444><BR><BR>Analog input and output are now synchronized. The =
time delay=20
between them is exact and predictable, and subject only to the hardware =
jitter=20
of our scan clock, which is in the order of nanoseconds. <A =
name=3Dtoc4></A>
<H2>Staggering input and output clocks</A><BR></H2><BR>To minimize the =
time=20
between an input and its corresponding output, you might consider =
staggering the=20
scan clock (A/D) and update clock (D/A) as shown in the first figure. In =
this=20
implementation, the output occurs as soon as the processing is complete. =
In=20
other words, the software dictates the timing of our output. However, we =
cannot=20
implement software timing and expect the delay between the input and =
output=20
events to be regular. To do that, we need to use hardware timing and =
thus a=20
clock to guarantee that inputs and outputs occur at regular intervals =
with=20
minimal jitter. Using one clock, we can stagger A/D and D/A conversions =
by=20
initiating an input on the rising edge of our clock and initiating an =
output on=20
the falling edge of the same clock. Adjusting the clock=E2=80=99s duty =
cycle enables us=20
to vary the time between inputs and outputs until we have optimized the =
loop=20
cycle time. In addition, in some cases, we can divide the processing =
routine=20
into =E2=80=9Cpre-processing=E2=80=9D and =
=E2=80=9Cpost-processing=E2=80=9D sections. Dividing the processing=20
routine establishes an even smaller response time between inputs and =
outputs by=20
shifting some of the processing elsewhere as shown in the following=20
figure.<BR><BR><A=20
onclick=3D"window.open('http://zone.ni.com/devzone/jsp/largeImage.jsp?ima=
gename=3D/cms/images/devzone/tut/a/5b519f241040.gif&amp;language=3Dzh-CN'=
,'awindow','scrollbars=3Dyes, resizable=3Dyes');return false;"=20
href=3D"http://zone.ni.com/devzone/cda/tut/p/id/"><IMG=20
src=3D"http://zone.ni.com/cms/images/devzone/tut/a/5b519f241040.gif" =
width=3D525=20
border=3D0></A><BR><A=20
onclick=3D"window.open('http://zone.ni.com/devzone/jsp/largeImage.jsp?ima=
gename=3D/cms/images/devzone/tut/a/5b519f241040.gif&amp;language=3Dzh-CN'=
,'awindow','scrollbars=3Dyes,resizable=3Dyes');return false;"=20
href=3D"http://zone.ni.com/devzone/cda/tut/p/id/">[+] =
=E6=94=BE=E5=A4=A7=E5=9B=BE=E7=89=87</A> <BR><B>Related=20
Links:</B><BR><A =
href=3D"http://zone.ni.com/devzone/cda/epd/p/id/3259">Staggering=20
the Scan Clock and Update Clock</A><BR>
<DIV class=3Dnoindex>
<DIV class=3Ddocdetails>
<DIV class=3Dratings>16 =E8=AF=84=E7=BA=A7 | <STRONG>2.75</STRONG> out =
of 5</DIV><!-- Read in other language section --><A=20
href=3D"javascript:window.print()"><IMG class=3Dbottomalign height=3D13 =
alt=3D""=20
src=3D"http://zone.ni.com/images/global/us/icons/print.gif" width=3D18 =
border=3D0>=20
=E6=89=93=E5=8D=B0</A> </DIV></DIV>
<H3>=E8=AF=BB=E8=80=85=E7=95=99=E8=A8=80 | <A=20
href=3D"http://zone.ni.com/apps/utf8/nidz_display_comments.create_comment=
?p_title=3DTiming+deterministic+control+loops&amp;p_doc_id=3D5B519F243E66=
D010VGNVCM100000940AA482RCRD&amp;p_doc_type=3DTUT&amp;p_url=3Dhttp://zone=
.ni.com/devzone/cda/tut/p/id/4324&amp;p_doc_url_id=3D4324"=20
rel=3Dnofollow>=E6=8F=90=E4=BA=A4=E7=95=99=E8=A8=80</A> <SPAN =
class=3Dcta>=C2=BB</SPAN></H3>
<P></P>
<DIV class=3Ddottedline>&nbsp;</DIV>
<DIV class=3Dnoindex>
<DIV class=3Dlegalnotice>
<P><STRONG>=E6=B3=95=E5=BE=8B=E6=9D=A1=E6=AC=BE</STRONG><BR>=E6=9C=AC=E6=95=
=99=E7=A8=8B=E7=94=B1National =
Instruments=E5=85=AC=E5=8F=B8=EF=BC=88=E7=AE=80=E7=A7=B0=E2=80=9CNI=E2=80=
=9D=EF=BC=89=E5=BC=80=E5=8F=91=E3=80=82 =E5=B0=BD=E7=AE=A1National=20
Instruments=E5=8F=AF=E4=B8=BA=E8=AF=A5=E7=A8=8B=E5=BA=8F=E6=8F=90=E4=BE=9B=
=E6=8A=80=E6=9C=AF=E6=94=AF=E6=8C=81=EF=BC=8C=E4=BD=86=E6=98=AF=E8=AF=A5=E6=
=8C=87=E5=8D=97=E7=9A=84=E5=86=85=E5=AE=B9=E5=B9=B6=E9=9D=9E=E5=AE=8C=E5=85=
=A8=E9=80=9A=E8=BF=87=E6=B5=8B=E8=AF=95=E5=92=8C=E9=AA=8C=E8=AF=81=EF=BC=8C=
NI=E4=B8=8D=E4=BB=A5=E4=BB=BB=E4=BD=95=E6=96=B9=E5=BC=8F=E4=BF=9D=E8=AF=81=
=E5=85=B6=E8=B4=A8=E9=87=8F=EF=BC=8C=E4=B9=9F=E4=B8=8D=E4=BF=9D=E8=AF=81=E7=
=9B=B8=E5=85=B3=E4=BA=A7=E5=93=81=E6=88=96=E9=A9=B1=E5=8A=A8=E7=A8=8B=E5=BA=
=8F=E7=9A=84=E6=96=B0=E7=89=88=E6=9C=AC=E5=87=BA=E7=8E=B0=E6=97=B6=E7=BB=A7=
=E7=BB=AD=E4=B8=BA=E5=85=B6=E6=8F=90=E4=BE=9B=E6=8A=80=E6=9C=AF=E6=94=AF=E6=
=8C=81=E3=80=82=E6=9C=AC=E6=95=99=E7=A8=8B=E4=BB=85=E4=BB=A5=E5=85=B6=E2=80=
=9C=E7=8E=B0=E7=8A=B6=E2=80=9D=E5=90=91=E7=94=A8=E6=88=B7=E6=8F=90=E4=BE=9B=
=EF=BC=8C=E6=95=99=E7=A8=8B=E6=B2=A1=E6=9C=89=E4=BB=BB=E4=BD=95=E6=8B=85=E4=
=BF=9D=E3=80=82=E6=95=99=E7=A8=8B=E4=BD=BF=E7=94=A8=E5=8F=97ni.com=E7=BD=91=
=E7=AB=99=E4=B8=8A=E3=80=8A=E4=BD=BF=E7=94=A8=E6=9D=A1=E6=AC=BE=E3=80=8B=E7=
=9A=84=E7=BA=A6=E6=9D=9F=E3=80=82=20
(<A=20
href=3D"http://ni.com/legal/termsofuse/unitedstates/us/">http://ni.com/le=
gal/termsofuse/unitedstates/us/</A>)</P></DIV></DIV></DIV></DIV>
<DIV class=3Dnoindex>
<DIV class=3Dclearfloat>&nbsp;</DIV></DIV></DIV>
<DIV class=3Dnoindex></DIV></TD></TR></TABLE></DIV>
<DIV class=3Dclearfloat>&nbsp;</DIV>
<DIV></DIV>
<DIV class=3Dnoindex id=3Dfooter><A =
href=3D"http://www.ni.com/profile/zhs/"=20
rel=3Dnofollow>=E6=88=91=E7=9A=84=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF</A>=
 | <A href=3D"http://www.ni.com/rss/" rel=3Dnofollow>RSS</A>=20
| <A href=3D"http://www.ni.com/legal/privacy/unitedstates/us/"=20
rel=3Dnofollow>=E9=9A=90=E7=A7=81=E6=9D=83=E8=AF=B4=E6=98=8E</A> | <A =
href=3D"http://www.ni.com/legal/"=20
rel=3Dnofollow>=E6=B3=95=E5=BE=8B=E4=BF=A1=E6=81=AF</A> | <A =
href=3D"http://sine.ni.com/apps/utf8/nicc.call_me"=20
rel=3Dnofollow>=E8=81=94=E7=B3=BBNI</A> <SPAN class=3Dcopyright>=C2=A9 =
2008 National Instruments=20

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -