现代工业对电机控制要求的不断提高使得软件的规模和复杂度越来越高,而传统开发DSP电机控制软件的方式是手工编写C代码,其算法实现难度大、底层驱动配置复杂、开发效率低。针对该问题,研究一种高效的DSP代码开发方式——基于模型设计(Model Based Design,MBD),该方式以MATLAB为开发平台,可实现Simulink模型到C代码的自动转化,显著提高开发效率。文章首先介绍MBD对电机控制开发的支持并给出开发流程,然后以DSP永磁同步电机矢量控制为例,在Simulink下建立系统的仿真模型和代码模型,并自动生成C代码,最后将代码下载到DSP控制系统中进行软件测试。研究结果表明,利用MBD方式可快速、高效地开发出DSP电机控制代码,并且具有开发难度低、代码可移植性强等优点。
The scales and complexities of software for high-performance motor control are more and more enlarged because of the modern industry enhancing demands. But the traditional method of motor software development for DSP is programming C code by manual, and the efficiency is very low because of the big difficulty to realize control algorithm .and complexity to configure bottom drive. Aiming at this problem, a high efficiency way for DSP code development, modelbased design (MBD) was studied, by which the Simulink model could be translated into C code automatically and the developing efficiency was improved greatly. Firstly, the Model-based Design's supports and workflow for motor control system development were introduced. Therefore, the software development process for PMSM vector control systems was demonstrated, including the building of simulation model and code model in Simulink environment, and the generation of C code. Finally, the generated C code was downloaded into DSP system to test control soft. The research results show that the MBD method can develop DSP motor control code quickly and efficiently, and has the advantages of low-difficulty and good code portability.