网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 61IC中国电子在线 >> DSP >> FAQ >> 硬件开发 >> 文章正文
  采用DSP技术设计复杂的嵌入式控制系统(续上文)         ★★★ 【字体:
采用DSP技术设计复杂的嵌入式控制系统(续上文)
作者:admin    文章来源:本站原创    点击数:    更新时间:2004-7-27    
Deriving true acceleration, velocity and position equations
The equations derived above express the acceleration, velocity and position
of the shear assembly, as a function of the position of the sheet metal (r).
As long as the sheet metal moves with a constant velocity, the acceleration
, velocity, and position of the shear (r) can be expressed as a function of
time by simply multiplying by the constant velocity of the sheet metal (h)..
.
q(t) = q(r(t))
w(t) = w(r) h
a(t) = a(r) h2
However, if the sheet metal velocity changes with time, these equations bec
ome more complex...
q(t) = q(r(t))
w(t) = w(r) h(t)
a(t) = w(r) s(t) + a(r) h(t)2
...where s(t) is the acceleration of the sheet metal at any given time.
Controlling the motion of the shear
Up to this point we have focused our attention on the problem of determining
the acceleration, velocity, and position profiles needed to turn the shear
between cuts. We will now turn our attention to the problem of designing a c
ontrol system that will drive the shear's motor to precisely follow these sp
ecified profiles.
Unless the cut length happens to exactly match the circumference of the shea
r assembly, the shear will need to accelerate and then decelerate (or vice v
ersa) as it rotates into position for the next cut. As it makes its final ap
proach to the sheet metal, its acceleration, its velocity, and its position
must all be precisely adjusted, to ensure proper synchronization of its moti
on with the sheet metal.
In theory, the acceleration, the velocity of the shear will exactly track th
e profiles described by the equations above if we simply drive the motor in
such a way that it precisely tracks the equation for its position versus tim
e. We could use a digital signal processor to compute successive values for
the position curve (using the position equation derived above) and a D/A con
verter to convert that stream of digital values into a continuous analog ref
erence signal, in real time.
Unfortunately, motors never have a perfectly linear response. As a result, t
heir motion never precisely tracks the position signal used to drive them. S
ome of their nonlinearities are proportional to speed. For example, some ene
rgy is lost to friction, and the amount of energy loss increases with motor
speed. Other nonlinearities are proportional to acceleration. For example, t
he inertia of the motor (and its load) prevent the motor from precisely trac
king its position signal.
This is where our equations for velocity and acceleration can be used to imp
lement feed-forward control. A digital signal processor generates velocity a
nd acceleration signals (in addition to the position signal) based on the eq
uations derived above. These signals are then weighted and summed with the p
osition signal, to drive the motor. (See Figure 12)
The weighting factors for the velocity and the acceleration signals are adju
sted to precisely compensate for nonlinearities in the motor's response, all
owing for precise control of the motor.
Note: Some of the motor's nonlinearities are not proportional to position, v
elocity or acceleration. For example, when a motor is stopped, static fricti
on resists any resumption of motion. This makes the low end of the friction
vs. velocity curve nonlinear. To compensate for this, a nonlinear transform
table can be used (instead of a simple weighting factor) to scale the veloci
ty component that gets summed into the drive signal..(See Figure 13).
Implementing the Math
Since this application did not require an expensive floating point processor
, we used a fixed point processor. However, a few complications arose. The m
agnitude of the intermediate equation results had to be carefully watched. T
he equations shown above may look nice, but they pose a problem, when coded
for computation on a fixed point digital signal processor. You can easily ov
erflow the accumulators, or to lose the required accuracy, if you don't pay
attention to the order in which computations are performed.
The equations shown above are shown in the form in which we derived them, by
integration. However, to maintain accuracy we had to rearrange these equati
ons, to keep intermediate results within manageable limits.
We also rearranged the equations to minimize the number of divide operations
. A multiply operation can be performed by a digital signal processor in a s
ingle instruction cycle, but a divide operation might require dozens of inst
ruction cycles. The equations shown here were rewritten with this fact in mi
nd, so that only 1 divide operation was needed for each incoming position sa
mple (as opposed to 3).
Software
Implementing the equations for the feed-forward part of the system is a rela
tively simple task. The digital signal processor can be thought of as an evo
lved microcontroller - one that is very good at math.
The software required to run the system can be subdivided into 3 modules:
The main program
The interrupt service routine from the shear and feeder motors
The interrupt service routine from the VMEbus host, which provides the line
speed and the cut-length specifications.
The main program
The main program initially ramps the speed of the feeder and the shear up to
the requested line speed. This must be done with caution, so as not to prod
uce irregularly cut sheet-metal blanks during a line speed change. In order
for this to happen, the feeder motor and the shear motor must not be fed sig
nals that request accelerations beyond their capabilities. (Although feed-fo
rward control greatly improves the linearity of the motor responses, the mot
ors still can't respond accurately to step accelerations.)
Each time a fresh position feedback sample is received (via the serial port)
the digital signal processor computes new position, velocity, and accelerat
ion values, and sends them to the D/A converters, and hence to the servo-amp
lifiers of the motors.
The motor interrupt service routines
The interrupt service routine for the motors is activated each time a fresh
position sample is taken. Each sample is delivered to the interrupt service
routine as a single word, which contains a position sample from each of the
2 motors. The interrupt service routine separates and preprocesses these sam
ples, before passing them on to the main program.
This preprocessing is needed because the samples received from each motor in
crease linearly (as the shaft of the motor turns) and then drop back to zero
, when the motor reaches 360 degrees. Since the control equations use the pr
evious samples from the motor to compute derivatives of the motor's motion,
the interrupt service routine must notify the main program each time a revol
ution is completed. Since the previous sample was at the top of the ramp, an
d the current sample is at the bottom, the previous samples must then be "ad
justed" to eliminate the discontinuity.
Once it completes all of the preprocessing, the interrupt service routine re
turns, allowing the main program to compute new position, velocity and accel
eration values, using the control equations.
The host interrupt service routine
The interrupt service routine for the VMEbus host is far less complex than t
he motor control interrupt service routine. It simply retrieves the new line
speed and/or the new cut length information, and then notifies the main pro
gram that there's a change. The main program then accepts the new informatio
n and adjusts its position, velocity and acceleration parameters accordingly
.
Note: A host computer is not really necessary. New line speed and cut-length
specifications could be supplied by thumbwheel switches, or by some other s
imilar interface.
The Processor
Because of its specialized hardware architecture, a digital signal processor
can do a multiply-accumulate operation in a single cycle. It also exhibits
very little interrupt latency time. These characteristics make it ideal for
handling the equations required for real-time modeling of dynamic systems.
A single digital signal processor can replace several Programmable Logic Con
trollers, greatly simplifying the synchronization of the various motors on a
n assembly line. The replacement of several subsystems with a single digital
-signal-processor-based controller also greatly simplifies the overall archi
tecture, reducing costs by 2 orders of magnitude.
The DSP56001
One digital signal processor that lends itself well to embedded control is t
he DSP56001 from Motorola. This digital signal processor has several feature
s that make it particularly attractive as a real-time processor:
Significant internal RAM space (3 Kbytes)
Built in Sine and Cosine tables, which are useful if Fast Fourier Transforms
(FFTs) and filters will be implemented.
Two 56-bit-wide arithmetic accumulators
Two 48-bit-wide logical accumulators
Seven address registers, complete with offset registers and address mode con
trol registers. Addressing may be performed with pre/post increment & decrem
ent, indexed by an offset, or bit-reversed (which is useful for working with
FFTs).
Three separate address spaces - 1 for program and 2 for data. The 2 data spa
ces are handy if a signal has a real and imaginary component. Both data spac
es can be accessed simultaneously, if necessary
Hardware multiply accumulate (single-cycle)
Extremely low interrupt latency time - 4 instruction cycles to get to the in
terrupt service routine.
While some of these features (such as Fast Fourier Transform capability) wer
e not crucial for our real-time control application, we found the hardware m
ultiply/accumulate and the low interrupt latency time extremely valuable. Th
e large internal RAM also allowed us to quickly access heavily used function
s and variables. This improved our program execution speed considerably.
We used a DSP56001-based processor board from Spectrum. Its 27 MHz processor
executes one instruction in 77 nsecs, and it has plenty of external RAM, an
d EPROM boot capability. The board is also equipped with serial ports and pa
rallel ports.
Choosing a hardware platform
In addition to the digital signal processor architecture, there are also som
e other practical concerns, such as the system architecture that will be pro
vided around the chip. The flexibility of the VMEbus architecture (in additi
on to its wide variety of analog I/O and motor controller boards) makes it a
logical choice. By assembling the system from off-the-shelf boards, we were
able to avoid a lot of hardware debugging. In addition, many of these speci
alized I/O boards are available in single-height versions, permitting the co
nstruction of a very compact VMEbus-based control system.
Providing for software development
You will probably want to write your software in C. In order to do that you'
ll need a C compiler, and an assembler/linker. Motorola provides a GNU C com
piler, a simulator, and an assembler/linker that runs on an IBM PC, or on a
Sun SPARCstation. We developed our source code on a Sun SPARCstation, and pr
oduced an executable code module, which we then downloaded into the digital
signal processor for final debug. Spectrum provides a debugging environment
that can be run from a PC (interfacing to the DSP board via a serial port) o
r over the VMEbus.
I/O
The analog I/O boards that we used were single-height, off-the-shelf boards
from Spectrum. They were 16-bit, dual-channel boards, capable of a 200 KHz A
/D sampling rate, and a 500 KHz D/A output rate. We received line speed and
cut length specifications from the host computer, through one of the digital
signal processor's serial ports.
The Prototype
We built a small-scale prototype of a flying shear to demonstrate the operat
ion of the flying shear controller. (See Figure 14) This prototype system us
es a 2 KHz A/D sample rate. If higher accuracy is required, the sample rate
can be increased by reprogramming a control register. However, unless higher
-resolution shaft encoders are provided on the motors, no benefit will be re
alized.
The prototype system used Spectron Microsystems' mSpox real-time operating s
ystem (running on the DSP56001), as well as Wind River Systems' VxWorks (run
ning on a Motorola 68030-based VMEbus host board).
The software was developed using STI's N!Power, running on a SPARCstation. S
oftware running on the workstation provided a real-time display of the error
signals. This workstation was not required to run the system, but was provi
ded primarily for display and debugging purposes.
Summaryurier Transform capability) were not crucial for our real-time contro
l application, we found the hardware multiply/accumulate and the low interru
pt latency time extremely valuable. The large internal RAM also allowed us t
o quickly access heavily used functions and variables. This improved our pro
gram execution speed considerably.
We used a DSP56001-based processor board from Spectrum. Its 27 MHz processor
executes one instruction in 77 nsecs, and it has plenty of al signal proces
sing technology to build high-performance real-time control systems. Complet
e families of digital signal processor boards with "real world" I/O capabili
ties are now available, off-the-shelf, from VMEbus board suppliers. These VM
Ebus boards, as well as off-the-shelf software development tools, allow the
prototyping and implementing of real-time embedded control systems, with lit
tle or no hardware development.
----------------------------------------------------------------------------
----
Lawrence Johnson is the applications engineer responsible for VMEbus and SBu
s products at Spectrum Signal Processing. He has 3 years experience developi
ng hardware and software applications for digital signal processors. Lawrenc
e's experience includes the design of ISA cards for audio work, and the writ
ing of software for speech compression, graphics processing, and control sys
tems.
Tim Marchant is the VMEbus and SBus manager at Spectrum Signal Processing. H
e has 14 years experience developing and building industrial and ruggedized
embedded systems. Tim's experience includes the construction of automation s
ystems, data acquisition systems, vehicle monitoring systems, as well as tel
ephony applications.
               欢迎点击进入:TI德州中文网   (国内唯一针对TI应用的中文技术网站)    文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    基于DSP的电子节气门PID控制
    基于DSP的多路音/视频采集处…
    低功耗实时可编程DSP数字助听…
    基于DSP+CPLD的断路器智能控…
    基于DSP+CPLD的交流电机调速…
    基于DSP的分布式微机保护测控…
    基于DSP的语音实时变速系统设…
    以ARM和DSP嵌入式系统为核心…
    基于双DSP的运动目标智能跟踪…
    高性能定点DSP位处理单元(BM…
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    站长:61IC 湘ICP备05002478号