计算机工程与应用 ›› 2009, Vol. 45 ›› Issue (34): 56-58.DOI: 10.3778/j.issn.1002-8331.2009.34.018

• 研发、设计、测试 • 上一篇    下一篇

MATLAB的单机型实时仿真系统的扩展与讨论

苗立东   

  1. 山东理工大学 特种车辆设计与控制研究所,山东 淄博 255091
  • 收稿日期:2009-08-19 修回日期:2009-09-23 出版日期:2009-12-01 发布日期:2009-12-01
  • 通讯作者: 苗立东

Extension and discussion of MATLAB real-time simulation on single PC

MIAO Li-dong   

  1. Special Vehicle Design & Control Lab,Shandong University of Technology,Zibo,Shandong 255091,China
  • Received:2009-08-19 Revised:2009-09-23 Online:2009-12-01 Published:2009-12-01
  • Contact: MIAO Li-dong

摘要: MATLAB下的实时视窗目标工具箱能够在一台运行Windows操作系统的微机上执行实时任务,可用于对自动控制系统进行实时仿真分析,但是此功能受限于其驱动程序。针对此问题,讨论了开发实时视窗目标工具箱驱动程序的关键问题,包括寄存器的访问和程序调试,提出了两种方法:(1)在实时视窗目标环境下借助于驱动程序的输出函数mdlOutputs;(2)利用xPC目标工具箱环境。在三台计算机上进行了不同的实验,实验结果表明所提出的方法能够正确地显示中间结果;采用开发的PCI-8360A模拟量输入驱动程序采集15路模拟量信号,结果表明实时视窗目标驱动程序在一定条件下可以和xPC目标驱动程序兼容,实时视窗目标的采样时间为0.18 ms要小于xPC目标的采样时间0.3 ms,这为实时视窗目标的扩展应用提供了新的思路。

关键词: 实时仿真, 实时视窗目标, xPC目标, 驱动程序, 系统函数

Abstract: The Real-Time Windows Target(RTWT) toolbox in MATLAB can make task run in real time on a single PC with Windows operating system,which can be used for real time simulation of control system,but such function is limited by its driver.Targeting this problem,key issues about development of RTWT driver is discussed,which includes register access and the debug of the driver.Two methods are put out,and the first one is to use the mdlOutputs function in the RTWT and the second one is to use the xPC environment.Different tests are conducted on three computers, and results show that the two methods can output debug results correctly.Test results for 15 channels analog input with developed PCI-8360A board driver show that RTWT driver is compatible with xPC one under certain conditions,and the sample time is 0.18 ms for RTWT and 0.3 ms for xPC target,which indicates that the RTWT target can run faster than the xPC one,and provides new idea for the use of RTWT.

Key words: real-time simulation, Real-Time Windows target(RTWT), xPC Target, driver, system function

中图分类号: