DEVELOPMENT TOOLS FOR DRIVE CONTROL APPLICATIONS BASED ON DSP ARCHITECTURES

DEVELOPMENT TOOLS FOR DRIVE CONTROL APPLICATIONS BASED ON DSP ARCHITECTURES

IFAC MCPL 2007 The 4th International Federation of Automatic Control Conference on Management and Control of Production and Logistics September 27-30,...

1MB Sizes 0 Downloads 102 Views

IFAC MCPL 2007 The 4th International Federation of Automatic Control Conference on Management and Control of Production and Logistics September 27-30, Sibiu - Romania

DEVELOPMENT TOOLS FOR DRIVE CONTROL APPLICATIONS BASED ON DSP ARCHITECTURES Alexandru Onea*, Vasile Horga† and Marcel Răţoi† *Technical University of Iasi/Dept. of automatic control and technical informatics, Iasi, Romania † Technical University of Iasi/Dept. of electrotechnics, Iasi, Romania

Abstract: The paper presents a Windows-based application, designed in order to assist a control algorithms developer in research and/or development activities. The application solves the main requirements of such a work. A new approach in software development was followed in order to obtain flexible and reusable DSP digital control applications. It was used a standard promoted by Texas Instruments that stimulates software modularity strategy. Experimental results show an implementation example of a modular control application using MSK243 DSP Motion Starter Kit. The software product can be used in educational process and in research as well. Copyright © 2007 IFAC Keywords: digital signal processors, graphic user interface, software engineering, software project management, debugging.

1. INTRODUCTION

nonlinear and complex functions that could not completely implemented by analog circuitry. Powerful and flexible, the DSP-based drive controllers create the potential for significant performance increase through the application of advanced control concepts. In most cases the embedded systems are endowed with minimum peripherals for user interface (LCD, keypad), thus ensuring fully autonomy to control systems. These peripherals appreciably narrow the possibilities of acquired data analysis and especially that of results presentation. The trend is to ensure a high flexibility for embedded systems, designing open architectures that allow remote control (Young, 1989). Thus autonomous digital control system concept is gradually replaced with an easily adaptable evolutionary structural ensemble. This way appears a migration from the producer-defined functionality to the user-defined functionality.

Last years many applications were developed on digital signal processors (DSP). A lot of papers present high performance control solutions and educational applications based on DSP control. A field of interest for DSP applications is motion control. A regulation concept able to incorporate the AC machines as the drive machine can only be achieved in an economically manner on a digital basis. The use of microelectronics in power control circuits enables the implementation of complex control concepts and allows the production of environmentally acceptable, self-optimized motor drives with applications ranging from computer peripherals, robotics, and machine tools to railway drive, ship propulsion, and rolling mills. Although with a mature technology and the basic problems already solved, controlled electric drives are still in the intense development phase. Several control energy conversion problems need yet to be solved.

A new high-end ac drive provides closed loop control of motor speed, which combined with Windowsbased configuration and hardware modularity plugin industrial networking, gives the user the highest functionality. This solution provides intuitive applications programming, using a template approach with a library of function blocks that

Numerically intensive, complex control structures require 16-32 bit digital controllers and signal processors. Compact digital controllers emulate the functions traditionally implemented in analog form and allow also the execution of 713

can be parameterized and interconnected easily using point-and-click operations. Moreover, many drives come with a suite of pre-programmed applications software for such applications that can be controlled via a rugged human-machine interface (Stefanescu and Cupcea, 2002).

and increases processing power for additional functions. To make use of the available computation power, the designer is required to apply advanced level skills for the design of the necessary software, that include know-how in electric motors and drives, digital control theory, real-time control implementation etc. For a fixed point DSP, all quantities (data, constants) are represented by integers in the [32768, 32767] range. This means that each quantity must be converted to fit within this range. In addition, every mathematical operation must be performed so that the result is maintained within this range. Special techniques, such as Q15 representation, are used to meet these requirements. The software development process is longer and difficult. Furthermore an important part of the solution must be written in assembly language to perform Q15 operations and increased execution speed. Thus the high complexity of Digital Motion Control (DMC) application requires high trained and experimented DMC specialists. This makes the development process a non-trivial one and its complexity is high.

A requirement of research and development laboratories is to find the shortest time-to-market. Consequently development and debugging time of new algorithms them must be minimized. This requirement can be satisfied only by using a welldefined system-level design methodology and by reducing the migration time between the algorithm elaboration and the hardware implementation. This background led to the idea to design and implement a software tool for behavior analysis of DSP motion control systems. With an induction motor electric drive stand and the Technosoft MSK243 DSP Motion Starter Kit, the authors widened the functionality of this ensemble developing a high-level graphical user interface. This application comprises both Windows interface powerful facilities and essential features of a software for motion control algorithms analysing, evaluation, developing, and debugging.

While in traditionally approach the software application is fully developed at programmer location, in modem approach of components-based type, only the software components are developed at this headquarters; the components integration in an application framework is realized m the field by system integrator. The software component is defined as a composition unity with well-defined interface by an agreement, and that has explicitly presented all the context dependencies. Software components can be independently installed each other and may be aggregated with third party (De Carli, 1993). In the new context, the software production can follows the natural trend of industrialization, the software production technological process being similar with that used today in motor car industry or in electronics, where their products are based on the production and assembling of standardized components. To obtain a software component three steps must cover: component specification, component production, and component integration into a framework application.

2. DESIGN PRINCIPLES AND SOFTWARE REQUIREMENTS Digital Signal Processor (DSP) technology makes digital control more practical and also offers a high level of performance. Traditionally, cost was a potential disadvantage of the DSP solution, but this aspect became minor with the continuing decline of DSP's costs. DSPs are capable of processing data at much faster rates than microcontrollers. Floating point DSPs are very attractive for a motion control system because their computational power and accuracy is higher than the fixed point DSPs. In a floating point DSP, all variables can be represented as physical values, and every mathematical operation is directly described. Most of the software can be written in C language. Thus sophisticated control algorithms can be implemented easier and faster and more accurately with floating point processors than with fixed-point processors. Because cost is an important restriction for most industrial applications, the scheme must be carefully chosen. Although economical floating-point processors are available, the cost of a control system based on these processors is still higher than a system based on fixed point DSPs. For many applications in industry and consumer goods, fixed-point solutions are still preferred (Kreindler, 2002).

The component specification is considered as industrial standard. Only this stage involves certain coordination of efforts in order to introduce and to impose standards for software components on the market. Based on these public specifications each independent producer of software components can develops his own component. The integration of components in applications frameworks is the last stage of this succession specifically to components programming paradigm. This stage means even final goal of components existence - application development in industrial manner. The software integrator must identify needed components and then purchases them from the market. The integration of components into an application is realized by means of application development framework, which represents a prefab assembling of components.

Texas Instruments (TI) developed a new controller concept with the new powerful singlechip motion controller family TMS320C24xx, which integrates a 16-bit fixed-point DSP core with intelligent peripherals to achieve a single chip solution. A 16-bit word length is used along with 32bit registers for storing intermediate results, and two hardware shifters are available to scale numbers independent of the CPU. This combination minimizes quantization and truncation errors, 714

The components-based programming will establish the polarizing of software industry. There are three possible structural levels of informatics world: - specification of software components interfaces, made by some organizations and consortiums of software houses, in order to settle standards; - production of components and/or applications development frameworks, realized in flexible small firms, having a small staff but with highest degree skills; - assembling of available components within applications, made on a large scale, from consulting firms having 1-2 employees to software divisions of multinational companies, this procedure being accessible to a computer programmer with modest training.

- all algorithms data references must be fully relocable. That is, there must be no "hard coded" data memory locations, - all algorithms code must be no "hard coded" program memory locations, - algorithms must never directly access any peripheral device. This is the responsibility of the client or framework, - all header files must support multiple inclusions within a single source file, - all modules must supply an initialization and finalization method. All standard-compliant algorithm implementations must be modules, which manage instance objects. Objects simple encapsulate the persistent state that is manipulated by the other functions or methods provided by the module.

TI recognizes that such methodologies need also be applied to high performance DSP systems (TI, 2000). To address this, TI is promoting a new Algorithm standard called XDAIS (eXpress DSP Algorithm Interface Standard), to be used as backbone of this effort. XDAIS focuses on a set of general rules and guidelines that can be applied to DSP algorithms, and, if followed, allow system integrators to quickly assemble production-quality systems from one or more algorithms. This standard is intended to enable a rich Commercial Off-the Shelf marketplace for DSP algorithm technology and to significantly reduce the time to market for new DSPbased products.

A module manages only one type of object. Thus, a module that manages objects roughly corresponds to a C++ class that follows a standard naming convention for its configuration parameters, interface header, and all external identifiers. These enable to obtain the benefits normally associated with objectoriented and component-based programming. Since all modules have a very clear interface and are self-contained, it is then a simple procedure to connect modules together, and make them interact in a system. Thus systems typically consist of o "top level" framework with numerous function calls to various modules.

Many modern DSP systems architectures can be partitioned along the line depicted in Fig. l (TI, 2000). Algorithms are "pure" data transducers; i.e., they simply take input data buffers and produce some number of output data buffer. The framework is the "glue" that integrates the algorithms with the real-time data sources and sinks using the core runtime support, to create a complete DSP subsystem. Framework for the DSP often interacts with the realtime peripherals and often defines the I/O interfaces for the algorithms.

It is recognized that many embedded DSP systems are sensitive to small memory spaces and critical execution times. To best address this, a combination of full "C" and C-callable assembly (CcA) functions is recommended. At the system level or framework, full "C" ensures maximum clarity, flexibility, and maintainability. At the module level, CcA functions allow memory and cycle efficient code to be developed with all the desired attributes one expects from a "C" function, i.e. to be reentrant, preemptive, revocable, instanced multiple times etc.

In order for an algorithm to be compliant with XDAIS, the algorithm writer must follow the general rules, some of them presented below: - all algorithms must follow the run-time convention TI implementation of the C programming language (C - callable). This ensures that the system integrator is free to use the C language to "bind" various algorithms together, and to control the flow of data between algorithms, - all algorithms must be reentrant within a preemptive system,

3. A DESIGN EXAMPLE FOR MOTOR CONTROL – DIRECT TORQUE CONTROL High efficiency control and estimation techniques related to asynchronous motors have been finding more and more application fields with Blaschke's well-known Field-Oriented Control (FOC) known since 1971. It was an intensive amount of work to improve the dynamic response and reduce the complexity of FOC methods. One such method is the Direct Torque Control (DTC) method developed by Takahashi in 1984. The method became popular due to the improved dynamic performance and simplified control strategy that it offers with respect to the FOC methods. More detailed information can be found in (Vas, 1998, Ratoi, et al., 2004).

Algorithm Cmd

Framework Status

Algorithm Algorithm

Core run time support

The DTC method involves the direct device of the appropriate/optimum switching modes, in order to keep the flux and torque errors within a prefixed band

Fig. 1. DTC system with speed sensor 715

limit. The errors are defined as the difference between the reference and measured/estimated values of flux and torque. Unlike FOC methods, DTC techniques require the use of hysteresis band controllers instead of flux and torque controllers. To replace the coordinate transformations of FOC, DTC use look-up table to carry out the switching procedure based on the inverter states. However, its extreme simplicity is counterbalanced by some inconveniences: torque ripple is typically higher for a same average switching frequency, and the inverter switching frequency is variable as a function of load torque and rotor speed.

SCI interface

Interr

Configuring, monitoring and remote control system

getSignals( ADC Driver ADC_DRV

GPT1 Timer

Compare & PWM

Circuit

AD Converter

ENCODER

Fig. 3. Hierarchical multilayer functional structure of DMC applications From standpoint of application structure the general configuration can be presented like a hierarchical multilayer functional structure (Fig. 3): - physical interface layer; - logical interface layer; - digital signal processing algorithms layer. At the physical interface layer level the application use the embedded hardware resources of DSP controller: - serial communication interface - SCI; - analog to digital converter - ADC; - quadrature encoder pulse interface - QEP; - PWM generator unit; - general purpose timer/counter circuits - GPTx: - hardware interrupts system. The next layer, of logical interface, implements the data exchange with external environment. This exchange is made by means of some data transfer functions and memory buffers for reading/writing obtained data. The last hierarchical layer, of digitally processing mathematical functions, performs proper processing of information and supplying adequate command in order to reach established control objectives. Using this minimal kernel in order to implement varied control structure the system integrator can aggregate in control space different software modules, which are standardized from viewpoint of interfacing and independently functional. The relationship between peripherals drivers and processing modules as well as between different aggregated modules is of "producer-consumer" type. The system framework, implemented in C programming language, provides maximum of flexibility and maintenance.

getSpeed(); QEP Circuit Driver SPEED_DRV

QEP Circuit

GPT2 Counter

AsM 3

2

Torque estimator

Control

Ω[pu]

ucc

setSVPWM (); PWM Modulator Driver SVPWM_DRV

ADC_DRV

Stator flux Rotor flux estimator estimator

Clark transformSPEED_DRV

The implementation of elementary algorithms, typical for blocks presented in fig. 2, was realized by means of modules, defined according to eXpress DSP Standard. The general structure of a module can be presented as in Fig. 4.

Logical

Monitor Program MON243

}

INVERTER

2 2

X +Y

Physical

read_char();write_ h ()

ia ib ic

CH

Sabc

CH

}

SVPWM_DRV

Sector selector Flux modul estimator

In order to digitally implement the control structure shown in Fig. 2 the authors have used the DSP Motion Starter Kit MSK243 (Technosoft, 2001). The digital signal processing algorithms represent implementations of mathematical functions, which process "pure" data. This matter requires that the interaction with input/output information do not be directly achieved by means of hardware peripherals of DSP digital system but by means of associated software drivers. In this way an independence of used digital system for developed algorithms is provided, their portability to the other system with the same type of DSP being guaranteed. On the other hand, peripherals drivers are software components specific to available hardware resources and, therefore, together with services offered by framework make up the minimal core for any digital control structure of electric drive system. SecondHalfISR () { .............. ...............

Look up table Speed controller Torque controller

1.1. Speed DTC Implementation using eXpressDSP Standard Concepts

FirstHalfIS R() { .............. ...............

Flux controller

Speed reference

To ensure a proper voltage selection by the DTC controller, the estimation of stator flux must be accurate. The calculation of the electromagnetic torque depends of the stator flux estimation accuracy. Stator flux and torque estimations are based on the asynchronous machine dynamic equations in the stationary stator reference frame. Fig. 2 shows the DTC system with speed sensor. The speed controller given in the diagram is a conventional PI controller. The development of the sector selector and the switching table is based on Takahashi's study.

main() { .........

RECTIFIER

Digital Motor Control

Flux reference

p1 p2 i1 i2 in

Electric drive system

Fig. 2. DTC system with speed sensor 716

Software module

pk o1 o2 om

Fig. 4. The general structure of a software module

• Association of "retorts" for application actions It is recommended that the interface transmit a "retort" for each user action. This requirement contributes too at user comfortable increasing and it impose that the application confirms, visual or audio, that it assumed user request and it is executing. Even whenever the computer executes a longer process the user must be informed about the process state and must offers the possibility to cancel it, when it is possible. • Aesthetics. Another important part of interface is visual elements design. Visual attributes furnish valuable data and communicate important information relatively to interaction behavior of some particular objects. In the same time, each visual element, which appears on the screen, competes to capture the user attention. • Simplicity. An interface must be simple, easily to learn and easily to manipulate. It must allow the access at all functionalities offered by an application. Maximum functionality of an application and creation of a simple interface are two conflicting goals but they can be balanced through a good design. A possibility of achievement a simple and useful interface is to use natural semantics and representation order. In order to be more efficient with a high complex application the user can be helped by using progressive disclosure.

Using own initializing function for settling p1,p2…….pk .parameters, each module can be adapted/configured for suitable requirements of the used electric drive system. The o1,o2,...om output values are calculated on the basis of input quantities, transferred by application framework, and of specific parameters. For the reason of speed execution and space memory requirements optimization the output evaluation functions were implemented using DSP assembly language. Moreover, in order to obtain maximum accuracy of information representation both input/output quantities and configuration parameters have adequate representation format, in Q8-Q15 range. 1.2. Graphical User Interface Design A well-designed graphical user interface is developed on the basis of some principles and development process that take into account the user and his/her actions. The development of a user-based software covers some stages like designing, prototyping, testing, and iteration. From conceptual standpoint these developing cycle stages are likewise the stages of general software application. But when a user interface is developed supplementary features arise and must be considered. A well-designed graphical user interface ensures a consistent and intelligible development environment and can influence the user devotion for that product.

A good interface will present the information in a hierarchical manner. For example, control information (available application commands) usually is included in menus. The menus names are eloquently for commands group of each menu. Depending on operation context, some menu options, unavailable at a given moment, may be hidden or disabled. When menus are designed, there are not recommended too much submenu levels because the user is constrained to memorize many commands to access a certain option. Toolbar is a good example in order to satisfy this requirement. Usually, for frequent commands buttons are associated in order that these commands are accessed as simple as possible.

In order that graphical users interface to be userfriendly any programmer has to comply with a lot of principles that confer versatile features to it. The requirements to which a graphical user interface must respond are (Cooper, 1995, Suciu, 1996): • Application control by the user. The first and very important requirement is that the interface have to be realized in such a way that the user feel the actions of the application are controlled by himself and not vice versa. The user must play an active role rather a reactive one. The user must have also the possibility to personalize some interface aspects varying with his/her preferences or cleverness. • Direct manipulation of graphical objects. When a software application is developed it must designed in such a way that the user directly manipulate the software representation of information Thus, he/she directly can see the cause-consequence relation between his/her interface performed actions and program reactions. Within user interface the information must be represented in a manner as naturally as possible. • Consistency. The consistency allows user to transfer their knowledge to new processes, and to rapidly learn them because they do not spend time any more to remember interaction differences. Any new application must respect the standard that the Windows operating system requirements and the consequence of this constrain is quite favorable: the operation with newly product can be rapidly learned because the users have already obtained these skills.

1.3. DSPGraphs - a Tool for Behaviour Analysis of DSP Motion Control Systems All the reasons above presented have led to the design and implementation of a graphical interface that can assist both a beginner user and an algorithms developer during performance analyzing and evaluation stages of DSP controlled ac electric drive. In order to implement this graphical environment the Visual C++ rapid application development tool was used. For the time being, DSPGraphs - a sovereign application - does not implement all the functions of a standard integrated developing environment; when a COFF object file is obtained DSP standard tools are used. On the other hand, as the binaries are obtained, the interface can be used to transfer them into target system memory, to remote start/stop the control application, to analyze different control structure quantities etc. Being an object oriented 717

application with single document interface, in the design stage is desirable to ensure the persistency of developed object by serializing the classes hierarchy on a linear support. Thus all specific variables of current project (path, COFF file name, analyzed quantities, interface configuration etc) are saved in a project file with gph extension; these files are used whenever workspace must be recovered. The File menu comprises all standard options of a Windows based application (New, Open, Save, Save as, Exit etc). Once the control application is included in project (the file with out extension) the user has many possibilities to configure the client window; until four displays are available, each of them visualizing maximum four studied variables. Fig.5 presents a graphical analyzing example of variables tracks belonging to a DTC structure presented in Fig. 2. The user must select them opening a dialog box like that presented in Fig. 6. For each selected variable the user must introduce the scale factor, which take into account Qx representation format, gain sensor, and used measure units.

Fig. 6. The dialog box for variable selection The example presented in Fig. 7 shows the evaluation modality of proportional coefficient ki belonging to PI speed controller structure. Although its representation format is Q12 the structures inspector automatically makes the conversion into/from floating point representation. On the other hand, if the on-line evaluation of a variable is desired, which requires the DSP application to be running, then using the same dialog box (On-Line command) the user can monitors the variable evolution, the refresh rate being established by RS232 serial communication line baud rate.

In the next step the user can distribute selected variables into interface displays; being self-scaled the application automatically manages the available presentation space. All commands for variables selection, variable distribution, color, width, and style plots setting, displays arrangement etc are grouped in Configurations menu.

In Fig. 8 is presented an on-line monitoring example of electric ac drive system reactive current, represented in per unit and Q12 representation format.

By means of Control menu options the user achieves the remote control of the DSP board. This way the user has the possibility to transfer the control application in DSP data/program memory, to start the application with/without acquiring selected variables for transient regime, to acquire the selected variables during the application running, to stop the application or to upload the acquired variables in order to be presented and analyzed. Any long operation can be canceled by the user using Abort command. If as a result of the electric drive system analysis and evaluation the user concludes that the behavior is not the predicted/desired one, he/she has the possibility to analyze more carefully the software structures that granulate the DSP application. The structures inspector from the Debug menu allows to get and/or to set the structures members values for structures used in control algorithm.

Fig. 7. An example of members structure evaluation

Fig. 5. A graphical analysis example – DTC structure implemented on MSK243 DSP Motion Starter KIT

Fig. 8. On-line monitoring of electrical drive orthogonal current 718

an integrated software development platform is not available for most of DSP. The software development environment presented in this paper solves the integration problem on a DSP platform, create an user-friendly programming environment on a PC platform which allows tracking of on-line variables, displays off- line and stores the program variables, solves the communication aspects while an application runs on DSP and is an open system for further development. An application framework for MSK243 Motion Starter Kit was presented. An example of a modular application was implemented with easy configurable and reusable software modules.

Fig. 9. Export/save options of EMF Windows image file format x1e-1

fisd_est

With the communication functions available in accompanying MSK243 Motion Starter Kit library and the debugging facilities the authors designed and implemented a graphical tool for analyzing, evaluation and debugging of electric drives digital motion control applications. The graphical user interface comply with standard requirements imposed to a Windows based application, and offers features for a user concerned in DSP motion control. The developed software has the advantages of an open system that allows the new functionalities addition.

Stator Flux Estimation

fisq_est

2.8

Wb

1.4

0.

-1.4

-2.8

REFERENCES 1.8

3.6

5.4

7.2

9.

x1e2

Young, M. (1989). The Technical Writer's Handbook. University Science, Mill Valley, CA. Stefanescu C.and Cupcea N. (2002). Measurement and Control Intelligent Systems (in Romanian), Editura Albastra, Cluj-Napoca, Romania. Kreindler L. (2002). DSP Solutions for Digital Motion Control. Journal of Electrical Engineering, Vol.2, pp. 13-22. De Carli, A. (1993). Motion Control: An Emergent Technology, 12th World Congress IFACSydney, Australia, pp.423-426,. Pârv B. (1998). Software Components (in Romanian). PC Report (in Romanian), No.69. *** (2000). A Software Modularity Strategy for Digital Control Systems, Texas Instruments. Vas P. (1998). Sensorless Vector and Direct Torque Control, Oxford University Press, Oxford, U.K. Ratoi M., Horga V. and Albu M., Diaconescu M.P.(2004), A DSP Implementation of DTC Method for an Induction Motor, 3rd International Conference on Electrical and Power Engineering, lasi, Romania, pp.10771084. *** (2001). MSK243 – DSP Motion Starter Kit, Technosoft S.A. Cooper A. (1995). About Face: The Essentials of User Interface Design, IDG Books, Foster City. Suciu D.M. (1996). Graphic User Interface Design Principles, PC Report (in Romanian), No..51.

time [msx10]

th

Fig. 10. The EMF obtained from Fig.9, the 4 display For drawing experimental date with the view to elaborating of comparative research reports for different control structures DSPGraphs application enables for selected display the exports of EMF Windows image file format. Fig. 9 presents a screen capture that contains the menu for export options of the displays content. The EMF image file obtained from this operation is shown in Fig. 10. Meanwhile, if one desires to realize other type of offline numerical analysis DSPGraphs saves all the acquired variables in ASCII type file, compatible with MATLAB m-file format. Thus this Windows-based application solves the main requirements specific to algorithms control research and development activity for high dynamic systems like electric drive. Its toolbar brings together the frequently used commands, their identification being made by graphical metaphors. 4. CONCLUSION The DSP is a solution for hard real-time control problems, but the software tools are rather poor and

719