Rapid Prototyping of Control Systems Using Embedded Target For TI C2000 DSP
Rapid Prototyping of Control Systems Using Embedded Target For TI C2000 DSP
Rapid Prototyping of Control Systems Using Embedded Target For TI C2000 DSP
&RQWURO $XWRPDWLRQ-XO\$WKHQV*UHHFH
Abstract— The paper presents a digital control is easier: powerful C and C++ compilers are available,
application, in which a tuning method is proposed for DC which remove the need to code in assembly, speeding the
motors, using DSP from Texas Instruments (TI). development process [3].
Experimental application for the DC motor illustrates the CACSD (Computer Aided Control System Design)
effectiveness and the simplicity of the proposed method for tools are extensively used to generate real time code
controller design. The control algorithm for the drive automatically. The graphical programming approach
application runs on a TMS320F2812 DSP. Once the desired removes the need to write software by hand and allows the
functionality has been captured and simulated, using engineer to focus instead on improving functionality and
MATLAB/Simulink/Embedded Target for TI C2000 DSP performance. Complete system design is carried out
environment can be generated code for the DSP. All task within the simulation environment.
assignments to processor are automatically made by the
software. The DC Motor is driven by pulse width modulated With the great diversity of applications, a development
(PWM) signals generated by the DSP. environment must be flexible and provide exactly the
Keywords- PID control, limit cycle, PWM, DSP, functionality necessary for efficient problem solving.
embedded target, Simulink, Code Composer Studio. Mathworks' Simulink software is such a graphical
modelling tool.
I. INTRODUCTION Simulink is a platform for multidomain simulation and
Developing controllers for applications (electrical drive model-based design of dynamic systems. It provides an
systems) means large expenditure, when performed with interactive graphical environment and a customizable set
usual development methods. The workload comprises of block libraries. The engineer can accurately design,
development of a mathematical model as well as simulate, implement, and test control, signal processing,
algorithm design and implementation, off-line simulation, communications, and other time-varying systems.
and optimization. The whole process has to be restarted on A recent toolbox of Simulink is the 'Embedded Target'
occurring errors or divergences, which makes the for Texas Instruments' C2000 DSP platform.
development process time consuming and costly [1].
Rapid Control Prototyping is a way out of this situation, II. C2000 EMBBEDED TARGET
especially if the control algorithm is complex and a lot of Simulink, Real-Time Workshop, the Embedded Target
iteration steps are necessary. for TI C2000 DSP, and Link for Code Composer Studio
Digital signal processors (DSP) are a key technology (CCS; TI’s Integrated Development Environment) provide
enabling electric drives to be smoother, more efficient, an integrated platform for design, simulation,
more reliable and most importantly, cheaper. This is being implementation, and verification of embedded control
exploited in a whole spectrum of applications such as systems on standard and custom C2000 DSP targets (Fig.
washing machines, heating and air conditioning and 1) [4].
electric power assisted steering in cars. The processing Simulink models are constructed from standard
power of DSP controllers is allowing the accurate control libraries. Embedded Target provides blocks specific to the
motors with fewer sensors. C2000 DSP family: I/O, CAN, PWM, QEP, Read From
Apart from the basic requirement to control the motor's
speed and direction, modern motor controllers might also
be expected to regulate energy consumption and to
implement other functions, ranging from power factor
correction to Ethernet drivers and TCP/IP protocol stacks.
Depending on application requirements, system
complexity ranges from the minimal DC brush motor
controller to high end vector drives [2].
DSP application development has changed markedly in
the last decade. The lack of efficient C compilers for DSP
obliged developers to write algorithms by hand using a Figure 1. The steps from the model to the implementation
low level assembly language - a laborious process. Today
3URFHHGLQJVRIWKHWK0HGLWHUUDQHDQ&RQIHUHQFHRQ 7
&RQWURO $XWRPDWLRQ-XO\$WKHQV*UHHFH
V. CONTROLLER TUNING
Figure 3. The motor driver A key method for auto-tuning is the use relay feedback
method [7]. Processes with the dynamics typically
encountered in process control will exhibit limit cycle
oscillations. The relay feedback causes the process to
oscillate with controlled amplitude. The frequency of the
limit cycle is approximately the ultimate frequency where
the process has a phase lag of 180o. The ratio of the
amplitude of limit cycle and the relay amplitude is
approximately the process gain at that frequency. Thus a
point on the Nyquist curve of the open loop dynamics
close to the ultimate point is determined.
The parameters of the controller can be computed using
Ziegler-Nichols tuning methods or tuning with specify
phase and amplitude margin. Better results were obtained
by specifying the phase and amplitude margin. The
implementation of the last tuning method is presented
below. Consider a situation where one point on the
Nyquist curve for the open loop system is known. With
PID control it is possible to move the given point on the
Nyquist curve to an arbitrary position in the complex
plane.
Figure 4. Computer, eZdsp F2812 target, oscilloscope, DC motor,
motor driver and power supply A limit cycle is obtained by introducing in the control
loop a relay type nonlinearity (Fig. 9). The Simulink block
diagram for obtaining the limit cycle is shown in Fig. 10.
3URFHHGLQJVRIWKHWK0HGLWHUUDQHDQ&RQIHUHQFHRQ 7
&RQWURO $XWRPDWLRQ-XO\$WKHQV*UHHFH
If the error is smaller than zero the PWM duty ratio will Solving equation (3), for Ti = αTd with α ∈ ( 2 ÷ 6) ,
be 95% and if it is greater than zero the duty ratio will be
of 80%, thus obtaining a limit cycle. RTDX blocks are is obtained the derivative time constant:
used to fetch and retrieve data from the target. For this in
the Simulink model From RTDX and To RTDX blocks 1
have been added. Td = (tan γ m + 4 α + tan 2 γ m ) . (4)
The obtained limit cycle is shown in Fig. 11. 2ω0
From Fig. 10 the critical period Tu is determined. The
ultimate gain Ku is computed using relation: If the magnitude of the open loop transfer function is
specified to k m simple trigonometric calculations give
4d k p = k m K u cos γ m . (5)
Ku = . (1)
πa
The step response, using the computed PID controller,
The open loop transfer function with PID control is: is shown in Fig. 12.
In order to obtain the step reference input signal is used
1 the Simulink diagram shown in Fig. 13.
k p (1 − + jωTd ) H DCM . (2)
jωTi VI. INSTRUMENTATION, DATA AQUISISION AND
RESULTS
Consider the phase of the PID controller at
Until recently, developers were forced to stop their
ω0 = 2π Tu to be γ m : application with a breakpoint to exchange data
"snapshots" with the host computer in a technique that is
called "stop-mode debugging". This intrusive approach
1 can be misleading, because the isolated snapshot of a
arctg (ωTd − ) =γm . (3)
ωTi halted high-speed application cannot show the real-world
operation of the system [8].
To solve this problem, TI developed RTDX, or Real
Time Data Exchange, which gives designers continuous,
real- time visibility into their applications.
RTDX enables real-time, asynchronous exchange of
data between the target and the host, without stopping the
Figure 9. Relay feedback diagram
target.
In essence, the RTDX data link provides a "data pipe"
between DSP application and the host. The bidirectional
capability allows developers to access data from the
application for real-time visibility, or to simulate data
input to the DSP, perhaps before real-time sensor
hardware is available. This shortens development time by
giving developers a realistic view of the way their
systems operate.
The drive can be controlled using a graphical user
interface (GUI), created using GUIDE, the MATLAB
Graphical User Interface development environment,
which provides a set of tools for creating graphical user
interfaces (GUIs).
The instrumentation control panel is shown if Fig. 14.
The target speed, which is set by turning the needle of an
Angular Gauge Control, the speed, the command and
Figure 10. Simulink block diagram of Ziegler – Nichols ultimate period the PWM signal can be analyzed and displayed. In the
method upper graphic of the panel the DC motor step response is
shown.
VII. CONCLUSIONS
The paper presented a digital control application in
which a PID tuning method for a DC motor is
implemented and tested. The control algorithm runs on
the eZdsp F2812 target equipped with a DSP
(TMS320F2812).
Using this design approach, there is no need to
determine an algorithm or to compute a mathematical
model of the motor. The parameters of the controller are
determined using experimental methods. The overshot
obtained is under 10%, an acceptable result.
The real-time code for the complete system is
automatically generated using Embedded Target and Real
Time Work Shop. No hand-coding is required. Time for
implementation and testing is minimized.
In the feature we plan a similar approach for a
Brushless DC Motor.
REFERENCES
[1] H. Hanselmann, “Control: the total development environment,”
International Conference on Signal Processing Applications,
Boston, MA, 1995.
[2] K. Godbole, O. Monnier, and J. Skinner Gray , “Modern motor
controllers must do more than just spin the motor”,
http://www.neon.co.uk/campus/articles/texas/ti_articles_spring04.
cfm
[3] R. Poley,“Blocks bring benefits”, http://www.neon.co.uk/ campus/
articles/texas/ ti_articles_autumn05.cfm.
[4] *****, www.mathworks.com.
[5] B. Anderson, and J. Moore, Linear optimal control. Prentice-Hall,
Englenwood Cliffs, New Jersy, 1971.