Implementation of Serial Communication in Permanent Magnet Synchronous Motor Control System

Publisher:HarmoniousVibesLatest update time:2011-03-26 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

When developing a permanent magnet synchronous motor control system with DSP as the core, it is necessary to observe various variables in the drive system in a timely manner, and at the same time control some programs and modify specific parameters. In actual operation, DSP cannot be controlled by external ports, and the serial communication module built into DSP is needed to solve this problem. The entire monitoring system is composed of a host computer and a motor control system with DSP as the core. The PC changes the torque and flux setting in the DSP program through the serial port, and adjusts the PI parameters, etc. The motor control system completes the control of the motor and collects relevant data to feed back to the PC for analysis, processing, display and storage. This article takes DSP control of permanent magnet synchronous motor as an example to introduce the implementation of serial communication in the entire control system.

1 Permanent Magnet Synchronous Motor Control System

The block diagram of the permanent magnet synchronous motor control system is shown in Figure 1. It adopts the direct torque control method, which is a high-performance control strategy for AC motors proposed in the 1980s. This control system is a dual closed-loop control system for speed and torque. The system uses voltage and current sensors to detect the DC bus voltage Vdc. And the stator two-phase currents i and i, and converts the voltage and current variables in the stator three-phase coordinate system into two-phase components in the α-β stationary stator coordinate system through coordinate transformation. The actual values ​​of the stator flux and torque obtained by the flux and torque observer are used as feedback quantities and compared with the given values ​​of the flux and torque. The error signal obtained passes through the hysteresis control unit of the flux and torque regulator to obtain 0, 1 control signals. Then, considering the area where the current stator flux is located, the appropriate voltage space vector is selected to control the rotation speed and direction of the stator flux, so that torque regulation can be achieved directly and quickly.

Permanent magnet synchronous motor control system block diagram

If the experimenters can observe and adjust the control parameters such as torque, flux, voltage, current, etc. in a timely manner, the development efficiency of the motor control system will be greatly improved.

2 Implementation of serial communication

The realization of serial communication between PC and DSP includes three parts, namely hardware design, upper computer program design and lower computer program design.

2.1 Serial Communication Hardware Design

Considering the actual needs of this test platform, RS-232 is used to realize data transmission between PC and DSP. Now RS. 232 communication port is a necessary configuration on every computer, usually including two ports COM1 and COM2, so it is very convenient to connect the upper computer with the lower computer to realize the computer's monitoring and control of the production site. Figure 2 is the TMS320LF2407 serial communication interface 1:1 circuit [1]. This circuit uses the driver chip MAX232 that complies with the RS-232 standard for serial communication. The MAX232 chip has low power consumption, high integration, +5 V power supply, and 2 receiving and transmitting channels. Since TMS320LF2407 uses +3.3 V power supply, it is necessary to convert the 5 V 1tI1L level to 3.3 V high level. The entire interface circuit is simple and has high reliability.

TMS320LF2407 serial communication interface

2.2 Host computer program design

Delphi is an object-oriented visual programming tool with a powerful integrated development environment and a very fast compiler. It combines the powerful functions of Visual C++ with the easy-to-learn and easy-to-use features of VB. By installing the MSComm control, serial communication can be easily implemented in the Delphi environment [2]. MSComm provides two methods for dealing with communication problems: one is event-driven method and the other is query method. This system uses the event-driven method, which has timely program response and high reliability. As long as you understand the properties and event usage of MSComm, you can operate the serial port.

Its main properties are:

(1)eommport attribute, used to set and return the serial port number of the connection;

(2) The settings attribute sets and returns the baud rate, parity, data bits, and stop bit parameters of the serial port in character form;

(3) po~open attribute, used to set or return the status of the communication connection port;

(4) input attribute, used to return and delete characters from the input buffer;

(5) output attribute, used to input the data to be sent into the transmission buffer;

(6) inputlen attribute, used to specify the length or number of bytes of the string read from serial port I:I;

(7) The handshaking attribute is used to specify the handshaking protocol between the two communicating parties;

(8) rthreshold property, used to set or return the number of bytes that triggers a receive event;

(9) The sthreshold property is used to set and return the minimum number of characters allowed in the transfer buffer;

(10) The commevent attribute generates an oncomm event when a communication error or event occurs;

(11) inbufercount attribute, which is used to count the number of characters in the receive buffer;

(12) The inputmode attribute is used to set or return the type of data retrieved by the input attribute.

In program design, you must first initialize MSComm. You can double-click the MSComm control to set it, or you can modify it in the program.

This system designs its own communication protocol according to needs.

(1) Frames are divided into two categories, namely control frames and data frames. Control frames are control commands issued by the host computer, and data frames are real-time data from the host and slave computers.

(2) The control frame in the communication between the upper computer and the lower computer is in the format of one byte and is defined as follows: AA means the lower computer sends data; AB means the lower computer receives data; AC means the lower computer stops sending data

(3) The data frame is two bytes, and the data range is 0 to 65535, which meets the data requirements.

For example, to set the motor flux to 200, the communication command consists of 4 bytes, and the data format is AB0400C8. Among them: AB is the control frame, 04 represents the flux, and 00C8 is the data frame. Each byte contains 1 start bit, 1 stop bit, and 8 data bits, which are hidden in the underlying program. In actual application, the user only needs to set the flux value to 200 on the communication interface, and then click the "nSend" button to implement the command. Figure 3 is a flow chart of PC sending data.

PC sending data flow chart
2.3 Lower computer program design

TMS320LF2407 contains a serial communication module (SCI), and the register of SCI is 8 bits. The programmable SC1 supports serial digital communication between CPU and other asynchronous peripherals using standard non-return-to-zero (NRZ) format. The receiver and transmitter of SCI are double buffered, each with its own independent enable and interrupt bits. The baud rate can be programmed through a 16-bit baud rate selection register. In order to ensure the success of serial communication, the SCI module of DSP must be initialized before communication, and the baud rate, parity, stop bit and the number of bits contained in each byte must be set. The settings of these parameters must be consistent with the settings on the PC, otherwise it will cause transmission errors. In the communication between DSP and PC, for DSP, the main function of communication is to receive data from PC and send data to PC. Data can be received in two ways: query and interrupt. The query method requires the program to detect the communication port in a loop, which wastes DSP resources. Therefore, this system uses the interrupt method when receiving data; but when sending data, since there is a lot of data to be sent, if the interrupt method is also used, it will interfere with the control of the motor and the motor cannot run smoothly. Therefore, the query method is used. Set the send flag bit in the interrupt subroutine, and decide whether to send data by querying the flag bit in the main program. In the process of sending data, the lower computer needs to send multiple groups of data, each group of data corresponds to different motor parameters. How to correctly distinguish these data is the key to successful communication. This system uses the set order of the lower computer sending parameters, the inputlen attribute of the MSComm control, and the rthreshold attribute to solve this problem. In addition, the lower computer receiving and sending registers are 8 bits, and the flag variable needs to be set to distinguish and merge the high and low bytes. Figure 4 is a flowchart of the lower computer communication program.

Lower computer communication program flowchart

3 Test results

The serial communication between DSP and PC can be easily realized by using the SCI module and MSComm control of DSP. The design method introduced in this paper has been verified on the PC and the direct torque control system test platform with TMS320LF2407 as the core. The results show that the permanent magnet synchronous motor can be controlled by the PC. Figure 5 is the upper computer monitoring interface, which includes parameter sending and data acquisition. It can display the given value and actual value of speed, flux and torque, which is convenient for users to compare. Figure 6 is the speed observation diagram of the permanent magnet synchronous motor when it is running without load. Among them: the straight line represents the speed given value, and the curve is the actual speed value. The speed given value is 500 r/min. The speed is 499r/min measured by the tachometer. It can be seen from the figure that the speed fluctuates around the given value with a very small error, proving that the speed can be well controlled. Figure 7 is a comparison chart of the given value and actual value of the flux linkage standard value. The given value of flux linkage is 200. The Q12 format is used in DSP. Finally, after calculation and feedback to the host computer, it should be 0.2. The straight line is the given value and the curve is the actual value. It can be seen from the figure that the overshoot is very small and the flux linkage parameters can also be accurately fed back to the PC, which is consistent with the expected results of the test.

Comparison diagram of given value and actual value of flux per unit value

Comparison diagram of given value and actual value of flux per unit value

Comparison diagram of given value and actual value of flux per unit value

4 Conclusion

The master-slave structure of PC and DSP can not only give full play to the data processing capability of DSP, but also have a good human-machine interface, which greatly facilitates the development and debugging of the system. The serial communication between DSP and PC can realize the real-time upload of the parameters of the lower computer, so that the user can grasp the motor status performance at any time; through the online modification of the DSP program by the upper computer, the motor can run as required, realizing the full digital real-time control of the motor. The key problems solved in this paper lay the foundation for the next step of realizing the online monitoring of the performance of the motor control system.

Reference address:Implementation of Serial Communication in Permanent Magnet Synchronous Motor Control System

Previous article:Simulation Research on Direct Torque Control System of Asynchronous Motor Based on EKF
Next article:Dual-motor control technology simplifies energy-efficient appliance design

Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号